Merge remote-tracking branch 'origin/2.5'

This commit is contained in:
Eike Ziller
2012-05-07 15:18:39 +02:00
36 changed files with 7212 additions and 1120 deletions

View File

@@ -4,7 +4,7 @@ import qbs.fileinfo 1.0 as FileInfo
Project { Project {
property string ide_version_major: '2' property string ide_version_major: '2'
property string ide_version_minor: '4' property string ide_version_minor: '4'
property string ide_version_release: '82' property string ide_version_release: '84'
property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release
property var additionalCppDefines: [ 'IDE_LIBRARY_BASENAME="lib"' ] property var additionalCppDefines: [ 'IDE_LIBRARY_BASENAME="lib"' ]
moduleSearchPaths: "qbs" moduleSearchPaths: "qbs"

View File

@@ -129,6 +129,12 @@
#endif // QT_BOOTSTRAPPED #endif // QT_BOOTSTRAPPED
#if QT_VERSION >= 0x050000
# define MAP_WORKS 0
#else
# define MAP_WORKS 1
#endif
int qtGhVersion = QT_VERSION; int qtGhVersion = QT_VERSION;
/*! /*!
@@ -1880,6 +1886,7 @@ static void qDumpQLocale(QDumper &d)
d.disarm(); d.disarm();
} }
#if MAP_WORKS
static void qDumpQMapNode(QDumper &d) static void qDumpQMapNode(QDumper &d)
{ {
const QMapData *h = reinterpret_cast<const QMapData *>(d.data); const QMapData *h = reinterpret_cast<const QMapData *>(d.data);
@@ -1997,6 +2004,7 @@ static void qDumpQMultiMap(QDumper &d)
{ {
qDumpQMap(d); qDumpQMap(d);
} }
#endif // MAP_WORKS
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
static void qDumpQModelIndex(QDumper &d) static void qDumpQModelIndex(QDumper &d)
@@ -2428,6 +2436,15 @@ static void qDumpQObjectPropertyList(QDumper &d)
d.disarm(); d.disarm();
} }
static QByteArray methodSignature(const QMetaMethod &method)
{
#if QT_VERSION >= 0x050000
return method.methodSignature();
#else
return QByteArray(method.signature());
#endif
}
static void qDumpQObjectMethodList(QDumper &d) static void qDumpQObjectMethodList(QDumper &d)
{ {
const QObject *ob = (const QObject *)d.data; const QObject *ob = (const QObject *)d.data;
@@ -2442,10 +2459,11 @@ static void qDumpQObjectMethodList(QDumper &d)
for (int i = 0; i != mo->methodCount(); ++i) { for (int i = 0; i != mo->methodCount(); ++i) {
const QMetaMethod & method = mo->method(i); const QMetaMethod & method = mo->method(i);
int mt = method.methodType(); int mt = method.methodType();
const QByteArray sig = methodSignature(method);
d.beginHash(); d.beginHash();
d.beginItem("name"); d.beginItem("name");
d.put(i).put(" ").put(mo->indexOfMethod(method.signature())); d.put(i).put(" ").put(mo->indexOfMethod(sig));
d.put(" ").put(method.signature()); d.put(" ").put(sig);
d.endItem(); d.endItem();
d.beginItem("value"); d.beginItem("value");
d.put((mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>")); d.put((mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>"));
@@ -2467,7 +2485,9 @@ static const char *qConnectionType(uint type)
case Qt::DirectConnection: output = "direct"; break; case Qt::DirectConnection: output = "direct"; break;
case Qt::QueuedConnection: output = "queued"; break; case Qt::QueuedConnection: output = "queued"; break;
case Qt::BlockingQueuedConnection: output = "blockingqueued"; break; case Qt::BlockingQueuedConnection: output = "blockingqueued"; break;
#if QT_VERSION < 0x050000
case 3: output = "autocompat"; break; case 3: output = "autocompat"; break;
#endif
#if QT_VERSION >= 0x040600 #if QT_VERSION >= 0x040600
case Qt::UniqueConnection: break; // Can't happen. case Qt::UniqueConnection: break; // Can't happen.
#endif #endif
@@ -2538,8 +2558,8 @@ static void qDumpQObjectSignal(QDumper &d)
d.endItem(); d.endItem();
d.putItem("type", ""); d.putItem("type", "");
if (conn.receiver) if (conn.receiver)
d.putItem("value", conn.receiver->metaObject() d.putItem("value", methodSignature(conn.receiver->metaObject()
->method(conn.method_()).signature()); ->method(conn.method_())));
else else
d.putItem("value", "<invalid receiver>"); d.putItem("value", "<invalid receiver>");
d.putItem("numchild", "0"); d.putItem("numchild", "0");
@@ -2580,11 +2600,11 @@ static void qDumpQObjectSignalList(QDumper &d)
for (int i = 0; i != methodCount; ++i) { for (int i = 0; i != methodCount; ++i) {
const QMetaMethod & method = mo->method(i); const QMetaMethod & method = mo->method(i);
if (method.methodType() == QMetaMethod::Signal) { if (method.methodType() == QMetaMethod::Signal) {
int k = mo->indexOfSignal(method.signature()); int k = mo->indexOfSignal(methodSignature(method));
const ConnectionList &connList = qConnectionList(ob, k); const ConnectionList &connList = qConnectionList(ob, k);
d.beginHash(); d.beginHash();
d.putItem("name", k); d.putItem("name", k);
d.putItem("value", method.signature()); d.putItem("value", methodSignature(method));
d.putItem("numchild", connList.size()); d.putItem("numchild", connList.size());
d.putItem("addr", d.data); d.putItem("addr", d.data);
d.putItem("type", NS"QObjectSignal"); d.putItem("type", NS"QObjectSignal");
@@ -2627,14 +2647,14 @@ static void qDumpQObjectSlot(QDumper &d)
const Connection &conn = connectionAt(connList, i); const Connection &conn = connectionAt(connList, i);
if (conn.receiver == ob && conn.method_() == slotNumber) { if (conn.receiver == ob && conn.method_() == slotNumber) {
++numchild; ++numchild;
const QMetaMethod &method = sender->metaObject()->method(signal); QMetaMethod method = sender->metaObject()->method(signal);
qDumpQObjectConnectionPart(d, ob, sender, s, " sender"); qDumpQObjectConnectionPart(d, ob, sender, s, " sender");
d.beginHash(); d.beginHash();
d.beginItem("name"); d.beginItem("name");
d.put(s).put(" signal"); d.put(s).put(" signal");
d.endItem(); d.endItem();
d.putItem("type", ""); d.putItem("type", "");
d.putItem("value", method.signature()); d.putItem("value", methodSignature(method));
d.putItem("numchild", "0"); d.putItem("numchild", "0");
d.endHash(); d.endHash();
d.beginHash(); d.beginHash();
@@ -2678,12 +2698,13 @@ static void qDumpQObjectSlotList(QDumper &d)
d.beginChildren(); d.beginChildren();
#if QT_VERSION >= 0x040400 #if QT_VERSION >= 0x040400
for (int i = 0; i != methodCount; ++i) { for (int i = 0; i != methodCount; ++i) {
const QMetaMethod & method = mo->method(i); QMetaMethod method = mo->method(i);
if (method.methodType() == QMetaMethod::Slot) { if (method.methodType() == QMetaMethod::Slot) {
d.beginHash(); d.beginHash();
int k = mo->indexOfSlot(method.signature()); QByteArray sig = methodSignature(method);
int k = mo->indexOfSlot(sig);
d.putItem("name", k); d.putItem("name", k);
d.putItem("value", method.signature()); d.putItem("value", sig);
// count senders. expensive... // count senders. expensive...
int numchild = 0; int numchild = 0;
@@ -3043,10 +3064,14 @@ static void qDumpQTextCodec(QDumper &d)
static void qDumpQVector(QDumper &d) static void qDumpQVector(QDumper &d)
{ {
qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid qCheckAccess(deref(d.data)); // is the d-ptr de-referenceable and valid
QVectorData *v = *reinterpret_cast<QVectorData *const*>(d.data);
#if QT_VERSION >= 0x050000
const unsigned typeddatasize = (char *)(&v->offset) - (char *)v;
#else
QVectorTypedData<int> *dummy = 0; QVectorTypedData<int> *dummy = 0;
const unsigned typeddatasize = (char*)(&dummy->array) - (char*)dummy; const unsigned typeddatasize = (char*)(&dummy->array) - (char*)dummy;
#endif
QVectorData *v = *reinterpret_cast<QVectorData *const*>(d.data);
// Try to provoke segfaults early to prevent the frontend // Try to provoke segfaults early to prevent the frontend
// from asking for unavailable child details // from asking for unavailable child details
@@ -3522,14 +3547,16 @@ static void handleProtocolVersion2and3(QDumper &d)
break; break;
case 'M': case 'M':
# ifndef QT_BOOTSTRAPPED # ifndef QT_BOOTSTRAPPED
if (isEqual(type, "QMap")) if (isEqual(type, "QModelIndex"))
qDumpQModelIndex(d);
# if MAP_WORKS
else if (isEqual(type, "QMap"))
qDumpQMap(d); qDumpQMap(d);
else if (isEqual(type, "QMapNode")) else if (isEqual(type, "QMapNode"))
qDumpQMapNode(d); qDumpQMapNode(d);
else if (isEqual(type, "QModelIndex"))
qDumpQModelIndex(d);
else if (isEqual(type, "QMultiMap")) else if (isEqual(type, "QMultiMap"))
qDumpQMultiMap(d); qDumpQMultiMap(d);
# endif
# endif # endif
break; break;
case 'O': case 'O':
@@ -3542,10 +3569,10 @@ static void handleProtocolVersion2and3(QDumper &d)
qDumpQObjectProperty(d); qDumpQObjectProperty(d);
else if (isEqual(type, "QObjectMethodList")) else if (isEqual(type, "QObjectMethodList"))
qDumpQObjectMethodList(d); qDumpQObjectMethodList(d);
else if (isEqual(type, "QObjectSignal"))
qDumpQObjectSignal(d);
else if (isEqual(type, "QObjectSignalList")) else if (isEqual(type, "QObjectSignalList"))
qDumpQObjectSignalList(d); qDumpQObjectSignalList(d);
else if (isEqual(type, "QObjectSignal"))
qDumpQObjectSignal(d);
else if (isEqual(type, "QObjectSlot")) else if (isEqual(type, "QObjectSlot"))
qDumpQObjectSlot(d); qDumpQObjectSlot(d);
else if (isEqual(type, "QObjectSlotList")) else if (isEqual(type, "QObjectSlotList"))
@@ -3680,8 +3707,10 @@ void *qDumpObjectData440(
"\"" NS "QLinkedList\"," "\"" NS "QLinkedList\","
"\"" NS "QList\"," "\"" NS "QList\","
"\"" NS "QLocale\"," "\"" NS "QLocale\","
#if MAP_WORKS
"\"" NS "QMap\"," "\"" NS "QMap\","
"\"" NS "QMapNode\"," "\"" NS "QMapNode\","
#endif
"\"" NS "QModelIndex\"," "\"" NS "QModelIndex\","
"\"" NS "QObject\"," "\"" NS "QObject\","
"\"" NS "QObjectMethodList\"," // hack to get nested properties display "\"" NS "QObjectMethodList\"," // hack to get nested properties display
@@ -3709,7 +3738,9 @@ void *qDumpObjectData440(
"\"" NS "QVariantList\"," "\"" NS "QVariantList\","
"\"" NS "QVector\"," "\"" NS "QVector\","
#if QT_VERSION >= 0x040500 #if QT_VERSION >= 0x040500
#if MAP_WORKS
"\"" NS "QMultiMap\"," "\"" NS "QMultiMap\","
#endif
"\"" NS "QSharedPointer\"," "\"" NS "QSharedPointer\","
"\"" NS "QWeakPointer\"," "\"" NS "QWeakPointer\","
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -8930,7 +8930,7 @@ Do you want to retry?</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<source>The 2D Painting example shows how QPainter and QGLWidget. The 2D Painting example shows how QPainter and QGLWidget work together.</source> <source>The 2D Painting example shows how QPainter and QGLWidget work together.</source>
<translation>Пример 2D Painting показывает, как совместно работают QPainter и QGLWidget.</translation> <translation>Пример 2D Painting показывает, как совместно работают QPainter и QGLWidget.</translation>
</message> </message>
<message> <message>
@@ -9773,6 +9773,14 @@ Reason: %3</source>
<source>Already at newest change</source> <source>Already at newest change</source>
<translation>Уже на последнем изменении</translation> <translation>Уже на последнем изменении</translation>
</message> </message>
<message>
<source>Unknown option: %1</source>
<translation>Неизвестный параметр: %1</translation>
</message>
<message>
<source>Argument must be positive: %1=%2</source>
<translation>Параметр должен быть положительным: %1=%2</translation>
</message>
</context> </context>
<context> <context>
<name>FakeVim::Internal::FakeVimHandler::Private</name> <name>FakeVim::Internal::FakeVimHandler::Private</name>
@@ -15912,7 +15920,7 @@ Preselects Qt for Simulator and mobile targets if available.</source>
</message> </message>
<message> <message>
<source>Unknown option %1</source> <source>Unknown option %1</source>
<translation>Неизвестная опция %1</translation> <translation>Неизвестный параметр: %1</translation>
</message> </message>
<message> <message>
<source>The option %1 requires an argument.</source> <source>The option %1 requires an argument.</source>

View File

@@ -146,7 +146,7 @@ Rectangle {
id: descriptionItem id: descriptionItem
height: 43 height: 43
color: "#7e7e7e" color: "#7e7e7e"
text: qsTr("The 2D Painting example shows how QPainter and QGLWidget. The 2D Painting example shows how QPainter and QGLWidget work together.") text: qsTr("The 2D Painting example shows how QPainter and QGLWidget work together.")
anchors.top: captionItem.bottom anchors.top: captionItem.bottom
anchors.topMargin: 10 anchors.topMargin: 10
opacity: 0 opacity: 0

View File

@@ -1495,7 +1495,10 @@ static inline bool dumpQString(const SymbolGroupValue &v, std::wostream &str)
wchar_t *memory; wchar_t *memory;
unsigned fullSize; unsigned fullSize;
unsigned size; unsigned size;
if (!readQt5StringData(dV, qtInfo.version, true, 10240, &fullSize, &size, &memory)) const SymbolGroupValue typeArrayV = dV[unsigned(0)];
if (!typeArrayV)
return false;
if (!readQt5StringData(typeArrayV, qtInfo.version, true, 10240, &fullSize, &size, &memory))
return false; return false;
if (size) { if (size) {
str << L'"' << memory; str << L'"' << memory;

View File

@@ -36,6 +36,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
@@ -416,7 +417,7 @@ Core::Id BinEditorFactory::id() const
QString BinEditorFactory::displayName() const QString BinEditorFactory::displayName() const
{ {
return tr(Constants::C_BINEDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME);
} }
Core::IEditor *BinEditorFactory::createEditor(QWidget *parent) Core::IEditor *BinEditorFactory::createEditor(QWidget *parent)

View File

@@ -410,6 +410,7 @@ void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
// Add a new bookmark if no bookmark existed on this line // Add a new bookmark if no bookmark existed on this line
Bookmark *bookmark = new Bookmark(fi.filePath(), editorLine, this); Bookmark *bookmark = new Bookmark(fi.filePath(), editorLine, this);
bookmark->init();
addBookmark(bookmark); addBookmark(bookmark);
} }
@@ -716,6 +717,7 @@ void BookmarkManager::addBookmark(const QString &s)
if (!filePath.isEmpty() && !findBookmark(fi.path(), fi.fileName(), lineNumber)) { if (!filePath.isEmpty() && !findBookmark(fi.path(), fi.fileName(), lineNumber)) {
Bookmark *b = new Bookmark(filePath, lineNumber, this); Bookmark *b = new Bookmark(filePath, lineNumber, this);
b->init();
addBookmark(b, false); addBookmark(b, false);
} }
} else { } else {

View File

@@ -105,7 +105,7 @@ Core::Id CppEditorFactory::id() const
QString CppEditorFactory::displayName() const QString CppEditorFactory::displayName() const
{ {
return tr(CppEditor::Constants::CPPEDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", CppEditor::Constants::CPPEDITOR_DISPLAY_NAME);
} }
Core::IEditor *CppEditorFactory::createEditor(QWidget *parent) Core::IEditor *CppEditorFactory::createEditor(QWidget *parent)

View File

@@ -1439,8 +1439,10 @@ void BreakHandler::BreakpointItem::updateMarker(BreakpointModelId id)
if (marker && (file != marker->fileName() || line != marker->lineNumber())) if (marker && (file != marker->fileName() || line != marker->lineNumber()))
destroyMarker(); destroyMarker();
if (!marker && !file.isEmpty() && line > 0) if (!marker && !file.isEmpty() && line > 0) {
marker = new BreakpointMarker(id, file, line); marker = new BreakpointMarker(id, file, line);
marker->init();
}
} }
QIcon BreakHandler::BreakpointItem::icon() const QIcon BreakHandler::BreakpointItem::icon() const

View File

@@ -648,6 +648,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
d->m_locationMark.reset(new TextEditor::BaseTextMark(file, line)); d->m_locationMark.reset(new TextEditor::BaseTextMark(file, line));
d->m_locationMark->setIcon(debuggerCore()->locationMarkIcon()); d->m_locationMark->setIcon(debuggerCore()->locationMarkIcon());
d->m_locationMark->setPriority(TextEditor::ITextMark::HighPriority); d->m_locationMark->setPriority(TextEditor::ITextMark::HighPriority);
d->m_locationMark->init();
} }
// FIXME: Breaks with split views. // FIXME: Breaks with split views.

View File

@@ -44,6 +44,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
#include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QDebug>
@@ -68,7 +69,7 @@ Core::Id FormEditorFactory::id() const
QString FormEditorFactory::displayName() const QString FormEditorFactory::displayName() const
{ {
return tr(C_DESIGNER_XML_DISPLAY_NAME); return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME);
} }
Core::IDocument *FormEditorFactory::open(const QString &fileName) Core::IDocument *FormEditorFactory::open(const QString &fileName)

View File

@@ -31,6 +31,7 @@
**************************************************************************/ **************************************************************************/
#include "fakevimactions.h" #include "fakevimactions.h"
#include "fakevimhandler.h"
// Please do not add any direct dependencies to other Qt Creator code here. // Please do not add any direct dependencies to other Qt Creator code here.
// Instead emit signals and let the FakeVimPlugin channel the information to // Instead emit signals and let the FakeVimPlugin channel the information to
@@ -41,15 +42,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
#include <QFile>
#include <QObject> #include <QObject>
#include <QPointer>
#include <QProcess>
#include <QRegExp>
#include <QTextStream>
#include <QtAlgorithms>
#include <QCoreApplication> #include <QCoreApplication>
#include <QStack>
using namespace Utils; using namespace Utils;
@@ -107,6 +101,23 @@ SavedAction *FakeVimSettings::item(const QString &name)
return m_items.value(m_nameToCode.value(name, -1), 0); return m_items.value(m_nameToCode.value(name, -1), 0);
} }
QString FakeVimSettings::trySetValue(const QString &name, const QString &value)
{
int code = m_nameToCode.value(name, -1);
if (code == -1)
return FakeVimHandler::tr("Unknown option: %1").arg(name);
if (code == ConfigTabStop || code == ConfigShiftWidth) {
if (value.toInt() <= 0)
return FakeVimHandler::tr("Argument must be positive: %1=%2")
.arg(name).arg(value);
}
SavedAction *act = item(code);
if (!act)
return FakeVimHandler::tr("Unknown option: %1").arg(name);
act->setValue(value);
return QString();
}
FakeVimSettings *theFakeVimSettings() FakeVimSettings *theFakeVimSettings()
{ {
static FakeVimSettings *instance = 0; static FakeVimSettings *instance = 0;

View File

@@ -85,6 +85,7 @@ public:
Utils::SavedAction *item(int code); Utils::SavedAction *item(int code);
Utils::SavedAction *item(const QString &name); Utils::SavedAction *item(const QString &name);
QString trySetValue(const QString &name, const QString &value);
void readSettings(QSettings *settings); void readSettings(QSettings *settings);
void writeSettings(QSettings *settings); void writeSettings(QSettings *settings);

View File

@@ -3585,9 +3585,10 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd)
} else if (cmd.args.contains('=')) { } else if (cmd.args.contains('=')) {
// Non-boolean config to set. // Non-boolean config to set.
int p = cmd.args.indexOf('='); int p = cmd.args.indexOf('=');
act = theFakeVimSettings()->item(cmd.args.left(p)); QString error = theFakeVimSettings()
if (act) ->trySetValue(cmd.args.left(p), cmd.args.mid(p + 1));
act->setValue(cmd.args.mid(p + 1)); if (!error.isEmpty())
showRedMessage(error);
} else { } else {
showRedMessage(FakeVimHandler::tr("Unknown option: ") + cmd.args); showRedMessage(FakeVimHandler::tr("Unknown option: ") + cmd.args);
} }

View File

@@ -115,8 +115,11 @@
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QSpinBox" name="spinBoxShiftWidth"> <widget class="QSpinBox" name="spinBoxShiftWidth">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>999</number> <number>80</number>
</property> </property>
</widget> </widget>
</item> </item>
@@ -149,8 +152,11 @@
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QSpinBox" name="spinBoxTabStop"> <widget class="QSpinBox" name="spinBoxTabStop">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>999</number> <number>80</number>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -75,6 +75,8 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin, QWidget *parent)
layout->setSpacing(0); layout->setSpacing(0);
m_ui.configWidget->setLayout(layout); m_ui.configWidget->setLayout(layout);
updateButtonStates(); updateButtonStates();
connect(m_plugin, SIGNAL(findFlagsChanged()), this, SLOT(updateFindFlags()));
} }
FindToolWindow::~FindToolWindow() FindToolWindow::~FindToolWindow()
@@ -131,6 +133,14 @@ void FindToolWindow::updateButtonStates()
m_ui.searchTerm->setEnabled(filterEnabled); m_ui.searchTerm->setEnabled(filterEnabled);
} }
void FindToolWindow::updateFindFlags()
{
m_ui.matchCase->setChecked(m_plugin->hasFindFlag(Find::FindCaseSensitively));
m_ui.wholeWords->setChecked(m_plugin->hasFindFlag(Find::FindWholeWords));
m_ui.regExp->setChecked(m_plugin->hasFindFlag(Find::FindRegularExpression));
}
void FindToolWindow::setFindFilters(const QList<IFindFilter *> &filters) void FindToolWindow::setFindFilters(const QList<IFindFilter *> &filters)
{ {
qDeleteAll(m_configWidgets); qDeleteAll(m_configWidgets);
@@ -160,10 +170,7 @@ void FindToolWindow::setCurrentFilter(IFindFilter *filter)
if (index >= 0) { if (index >= 0) {
setCurrentFilter(index); setCurrentFilter(index);
} }
m_ui.matchCase->setChecked(m_plugin->hasFindFlag(Find::FindCaseSensitively)); updateFindFlags();
m_ui.wholeWords->setChecked(m_plugin->hasFindFlag(Find::FindWholeWords));
m_ui.regExp->setChecked(m_plugin->hasFindFlag(Find::FindRegularExpression));
m_ui.searchTerm->setFocus(); m_ui.searchTerm->setFocus();
m_ui.searchTerm->selectAll(); m_ui.searchTerm->selectAll();
} }

View File

@@ -70,6 +70,7 @@ private slots:
void replace(); void replace();
void setCurrentFilter(int index); void setCurrentFilter(int index);
void updateButtonStates(); void updateButtonStates();
void updateFindFlags();
private: private:
void acceptAndGetParameters(QString *term, IFindFilter **filter); void acceptAndGetParameters(QString *term, IFindFilter **filter);

View File

@@ -39,6 +39,8 @@
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <QCoreApplication>
using namespace GenericProjectManager; using namespace GenericProjectManager;
using namespace GenericProjectManager::Internal; using namespace GenericProjectManager::Internal;
@@ -76,7 +78,7 @@ Core::Id ProjectFilesFactory::id() const
QString ProjectFilesFactory::displayName() const QString ProjectFilesFactory::displayName() const
{ {
return tr(Constants::FILES_EDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", Constants::FILES_EDITOR_DISPLAY_NAME);
} }
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -43,6 +43,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
@@ -72,7 +73,7 @@ Core::Id GLSLEditorFactory::id() const
QString GLSLEditorFactory::displayName() const QString GLSLEditorFactory::displayName() const
{ {
return tr(C_GLSLEDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", C_GLSLEDITOR_DISPLAY_NAME);
} }
Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent) Core::IEditor *GLSLEditorFactory::createEditor(QWidget *parent)

View File

@@ -36,6 +36,7 @@
#include "imageviewerconstants.h" #include "imageviewerconstants.h"
#include "imageviewer.h" #include "imageviewer.h"
#include <QCoreApplication>
#include <QMap> #include <QMap>
#include <QImageReader> #include <QImageReader>
#include <QtDebug> #include <QtDebug>
@@ -102,7 +103,7 @@ Core::Id ImageViewerFactory::id() const
QString ImageViewerFactory::displayName() const QString ImageViewerFactory::displayName() const
{ {
return tr(Constants::IMAGEVIEWER_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", Constants::IMAGEVIEWER_DISPLAY_NAME);
} }
Core::IDocument *ImageViewerFactory::open(const QString & /*fileName*/) Core::IDocument *ImageViewerFactory::open(const QString & /*fileName*/)

View File

@@ -110,6 +110,7 @@ void TaskHub::addTask(Task task)
TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible); TaskMark *mark = new TaskMark(task.taskId, task.file.toString(), task.line, visible);
mark->setIcon(taskTypeIcon(task.type)); mark->setIcon(taskTypeIcon(task.type));
mark->setPriority(TextEditor::ITextMark::LowPriority); mark->setPriority(TextEditor::ITextMark::LowPriority);
mark->init();
task.addMark(mark); task.addMark(mark);
} }
emit taskAdded(task); emit taskAdded(task);

View File

@@ -46,6 +46,7 @@
#include <coreplugin/infobar.h> #include <coreplugin/infobar.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
@@ -74,7 +75,7 @@ Core::Id QmlJSEditorFactory::id() const
QString QmlJSEditorFactory::displayName() const QString QmlJSEditorFactory::displayName() const
{ {
return tr(C_QMLJSEDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", C_QMLJSEDITOR_DISPLAY_NAME);
} }
Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent) Core::IEditor *QmlJSEditorFactory::createEditor(QWidget *parent)

View File

@@ -41,6 +41,7 @@
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <QAction> #include <QAction>
#include <QMenu> #include <QMenu>
@@ -75,7 +76,7 @@ Core::Id ProFileEditorFactory::id() const
QString ProFileEditorFactory::displayName() const QString ProFileEditorFactory::displayName() const
{ {
return tr(Qt4ProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", Qt4ProjectManager::Constants::PROFILE_EDITOR_DISPLAY_NAME);
} }
Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent) Core::IEditor *ProFileEditorFactory::createEditor(QWidget *parent)

View File

@@ -38,6 +38,7 @@
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <QCoreApplication>
#include <QFileInfo> #include <QFileInfo>
#include <qdebug.h> #include <qdebug.h>
@@ -61,7 +62,7 @@ Core::Id ResourceEditorFactory::id() const
QString ResourceEditorFactory::displayName() const QString ResourceEditorFactory::displayName() const
{ {
return tr(C_RESOURCEEDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", C_RESOURCEEDITOR_DISPLAY_NAME);
} }
Core::IEditor *ResourceEditorFactory::createEditor(QWidget *parent) Core::IEditor *ResourceEditorFactory::createEditor(QWidget *parent)

View File

@@ -38,6 +38,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
using namespace TextEditor; using namespace TextEditor;
using namespace TextEditor::Internal; using namespace TextEditor::Internal;
@@ -70,9 +71,9 @@ void BaseTextMarkRegistry::add(BaseTextMark *mark)
} }
} }
void BaseTextMarkRegistry::remove(BaseTextMark *mark) bool BaseTextMarkRegistry::remove(BaseTextMark *mark)
{ {
m_marks[Utils::FileName::fromString(mark->fileName())].remove(mark); return m_marks[Utils::FileName::fromString(mark->fileName())].remove(mark);
} }
void BaseTextMarkRegistry::editorOpened(Core::IEditor *editor) void BaseTextMarkRegistry::editorOpened(Core::IEditor *editor)
@@ -131,6 +132,13 @@ void BaseTextMarkRegistry::allDocumentsRenamed(const QString &oldName, const QSt
BaseTextMark::BaseTextMark(const QString &fileName, int lineNumber) BaseTextMark::BaseTextMark(const QString &fileName, int lineNumber)
: ITextMark(lineNumber), m_fileName(fileName) : ITextMark(lineNumber), m_fileName(fileName)
{
}
// we need two phase initilization, since we are calling virtual methods
// of BaseTextMark in add() and also accessing widthFactor
// which might be set in the derived constructor
void BaseTextMark::init()
{ {
Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->add(this); Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->add(this);
} }
@@ -138,7 +146,9 @@ BaseTextMark::BaseTextMark(const QString &fileName, int lineNumber)
BaseTextMark::~BaseTextMark() BaseTextMark::~BaseTextMark()
{ {
// oha we are deleted // oha we are deleted
Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->remove(this); bool b = Internal::TextEditorPlugin::instance()->baseTextMarkRegistry()->remove(this);
// If you get a assertion in this line, init() was never called
QTC_CHECK(b)
} }
void BaseTextMark::updateFileName(const QString &fileName) void BaseTextMark::updateFileName(const QString &fileName)

View File

@@ -60,6 +60,7 @@ class TEXTEDITOR_EXPORT BaseTextMark : public TextEditor::ITextMark
public: public:
BaseTextMark(const QString &fileName, int lineNumber); BaseTextMark(const QString &fileName, int lineNumber);
void init();
virtual ~BaseTextMark(); virtual ~BaseTextMark();
/// called if the filename of the document changed /// called if the filename of the document changed
@@ -80,7 +81,7 @@ public:
BaseTextMarkRegistry(QObject *parent); BaseTextMarkRegistry(QObject *parent);
void add(BaseTextMark *mark); void add(BaseTextMark *mark);
void remove(BaseTextMark *mark); bool remove(BaseTextMark *mark);
private slots: private slots:
void editorOpened(Core::IEditor *editor); void editorOpened(Core::IEditor *editor);
void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName); void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName);

View File

@@ -44,6 +44,7 @@
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/infobar.h> #include <coreplugin/infobar.h>
#include <QCoreApplication>
#include <QDebug> #include <QDebug>
using namespace TextEditor; using namespace TextEditor;
@@ -72,7 +73,7 @@ Core::Id PlainTextEditorFactory::id() const
QString PlainTextEditorFactory::displayName() const QString PlainTextEditorFactory::displayName() const
{ {
return tr(Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME); return qApp->translate("OpenWith::Editors", Core::Constants::K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME);
} }
Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent) Core::IEditor *PlainTextEditorFactory::createEditor(QWidget *parent)

View File

@@ -999,7 +999,9 @@ void CallgrindToolPrivate::createTextMarks()
continue; continue;
locations << location; locations << location;
m_textMarks.append(new CallgrindTextMark(index, fileName, lineNumber)); CallgrindTextMark *mark = new CallgrindTextMark(index, fileName, lineNumber);
mark->init();
m_textMarks.append(mark);
} }
} }

View File

@@ -58,7 +58,9 @@ TopicChooser::TopicChooser(QWidget *parent, const QString &keyword,
QMap<QString, QUrl>::const_iterator it = links.constBegin(); QMap<QString, QUrl>::const_iterator it = links.constBegin();
for (; it != links.constEnd(); ++it) { for (; it != links.constEnd(); ++it) {
m_links.append(it.value()); m_links.append(it.value());
model->appendRow(new QStandardItem(it.key())); QStandardItem *item = new QStandardItem(it.key());
item->setToolTip(it.value().toString());
model->appendRow(item);
} }
ui.listWidget->setModel(m_filterModel); ui.listWidget->setModel(m_filterModel);

View File

@@ -64,9 +64,13 @@ def setBreakpointsForCurrentProject(filesAndLines):
return False return False
invokeMenuItem("Debug", "Toggle Breakpoint") invokeMenuItem("Debug", "Toggle Breakpoint")
test.log('Set breakpoint in %s' % fName, curLine) test.log('Set breakpoint in %s' % fName, curLine)
try:
breakPointTreeView = waitForObject("{type='Debugger::Internal::BreakWindow' visible='1' " breakPointTreeView = waitForObject("{type='Debugger::Internal::BreakWindow' visible='1' "
"windowTitle='Breakpoints' name='Debugger.Docks.Break'}") "windowTitle='Breakpoints' name='Debugger.Docks.Break'}")
waitFor("breakPointTreeView.model().rowCount() == len(filesAndLines)", 2000) waitFor("breakPointTreeView.model().rowCount() == len(filesAndLines)", 2000)
except:
test.fatal("UI seems to have changed - check manually and fix this script.")
return False
test.compare(breakPointTreeView.model().rowCount(), len(filesAndLines), test.compare(breakPointTreeView.model().rowCount(), len(filesAndLines),
'Expected %d set break points, found %d listed' % 'Expected %d set break points, found %d listed' %
(len(filesAndLines), breakPointTreeView.model().rowCount())) (len(filesAndLines), breakPointTreeView.model().rowCount()))
@@ -89,8 +93,9 @@ def removeOldBreakpoints():
rect = breakPointTreeView.visualRect(currentIndex) rect = breakPointTreeView.visualRect(currentIndex)
mouseClick(breakPointTreeView, rect.x+5, rect.y+5, 0, Qt.LeftButton) mouseClick(breakPointTreeView, rect.x+5, rect.y+5, 0, Qt.LeftButton)
type(breakPointTreeView, "<Delete>") type(breakPointTreeView, "<Delete>")
except LookupError: except:
pass test.fatal("UI seems to have changed - check manually and fix this script.")
return False
return test.compare(model.rowCount(), 0, "Check if all breakpoints have been removed.") return test.compare(model.rowCount(), 0, "Check if all breakpoints have been removed.")
# function to do simple debugging of the current (configured) project # function to do simple debugging of the current (configured) project

View File

@@ -1,6 +1,9 @@
:Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'} :Behavior.Autocomplete common prefix_QCheckBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='partiallyComplete' text='Autocomplete common prefix' type='QCheckBox' visible='1'}
:Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'} :Behavior.completionTrigger_QComboBox {container=':CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox' name='completionTrigger' type='QComboBox' visible='1'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'} :CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget.CppTools__Internal__CompletionSettingsPage_QWidget' name='groupBox' title='Behavior' type='QGroupBox' visible='1'}
:Dialog.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'}
:Dialog.componentNameEdit_QLineEdit {name='componentNameEdit' type='QLineEdit' visible='1' window=':Dialog_QmlJSEditor::Internal::ComponentNameDialog'}
:Dialog_QmlJSEditor::Internal::ComponentNameDialog {name='QmlJSEditor__Internal__ComponentNameDialog' type='QmlJSEditor::Internal::ComponentNameDialog' visible='1' windowTitle='Dialog'}
:New Qt Quick Application.Add to version control:_QLabel {name='addToVersionControlLabel' text='Add to version control:' type='QLabel' visible='1'} :New Qt Quick Application.Add to version control:_QLabel {name='addToVersionControlLabel' text='Add to version control:' type='QLabel' visible='1'}
:Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1'} :Next_QPushButton {name='__qt__passive_wizardbutton1' text~='(Next.*|Continue)' type='QPushButton' visible='1'}
:Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} :Options.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
@@ -8,9 +11,13 @@
:Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'} :Options.qt_tabwidget_tabbar_QTabBar {name='qt_tabwidget_tabbar' type='QTabBar' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='(Options|Preferences)'} :Options_Core::Internal::SettingsDialog {type='Core::Internal::SettingsDialog' unnamed='1' visible='1' windowTitle~='(Options|Preferences)'}
:Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'} :Options_QListView {type='QListView' unnamed='1' visible='1' window=':Options_Core::Internal::SettingsDialog'}
:Qt Creator.Clear_QToolButton {text='Clear' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Create Build Configurations:_QComboBox {leftWidget=':Qt Creator.Create Build Configurations:_QLabel' type='QComboBox' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Create Build Configurations:_QLabel {text='Create build configurations:' type='QLabel' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'} :Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1'} :Qt Creator_Core::Internal::MainWindow {type='Core::Internal::MainWindow' unnamed='1' visible='1'}
:Qt Creator_Find::Internal::SearchResultTreeView {type='Find::Internal::SearchResultTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_QmlJSEditor::QmlJSTextEditorWidget {type='QmlJSEditor::QmlJSTextEditorWidget' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :Qt Creator_Utils::NavigationTreeView {type='Utils::NavigationTreeView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
:addToVersionControlComboBox_QComboBox {buddy=':New Qt Quick Application.Add to version control:_QLabel' name='addToVersionControlComboBox' type='QComboBox' visible='1'} :addToVersionControlComboBox_QComboBox {buddy=':New Qt Quick Application.Add to version control:_QLabel' name='addToVersionControlComboBox' type='QComboBox' visible='1'}

View File

@@ -5,6 +5,6 @@ ENVVARS=envvars
HOOK_SUB_PROCESSES=false HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0 IMPLICITAUTSTART=0
LANGUAGE=Python LANGUAGE=Python
TEST_CASES=tst_QMLS01 tst_QMLS02 TEST_CASES=tst_QMLS01 tst_QMLS02 tst_QMLS03 tst_QMLS04 tst_QMLS05
VERSION=2 VERSION=2
WRAPPERS=Qt WRAPPERS=Qt

View File

@@ -0,0 +1,105 @@
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
class ExpectedResult:
def __init__(self, file, lineNumber, lineContent):
self.file = file
self.lineNumber = lineNumber
self.lineContent = lineContent
# check if usage in code (expectedText) is found in resultsView
def checkUsages(resultsView, expectedResults):
# wait for results
resultsModel = resultsView.model()
waitFor("resultsModel.rowCount() > 0", 5000)
expectedResultIndex = 0
for row in range(resultsModel.rowCount()):
# enum Roles { ResultItemRole = Qt::UserRole, ResultLineRole, ResultLineNumberRole, ResultIconRole,
# SearchTermStartRole, SearchTermLengthRole, IsGeneratedRole };
index = resultsModel.index(row, 0)
# get only filename not full path
resultFile = str(index.data(Qt.UserRole + 1).toString()).replace("\\", "/").split('/')[-1]
for chRow in range(resultsModel.rowCount(index)):
chIndex = resultsModel.index(chRow, 0, index)
resultLine = str(chIndex.data(Qt.UserRole + 1).toString()).strip()
resultLineNumber = chIndex.data(Qt.UserRole + 2).toInt()
# verify if we don't get more results
if expectedResultIndex >= len(expectedResults):
test.log("More results than expected")
return False
# check expected text
if (not test.compare(expectedResults[expectedResultIndex].file, resultFile, "Result file comparison") or
not test.compare(expectedResults[expectedResultIndex].lineNumber, resultLineNumber, "Result line number comparison") or
not test.compare(expectedResults[expectedResultIndex].lineContent, resultLine, "Result line content comparison")):
return False
expectedResultIndex += 1
# verify if we get all results
if expectedResultIndex < len(expectedResults):
test.log("Less results than expected")
return False
return True
def main():
# prepare example project
sourceExample = os.path.abspath(sdkPath + "/Examples/4.7/declarative/animation/basics/property-animation")
if not neededFilePresent(sourceExample):
return
# copy example project to temp directory
templateDir = prepareTemplate(sourceExample)
examplePath = templateDir + "/propertyanimation.pro"
startApplication("qtcreator" + SettingsPath)
# open example project
openQmakeProject(examplePath)
# open qml file
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "propertyanimation.QML.qml.color-animation\\.qml", 5, 5, 0, Qt.LeftButton)
# get editor
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# 1. check usages using context menu
# place cursor to component
if not placeCursorToLine(editorArea, "Rectangle {"):
invokeMenuItem("File", "Exit")
return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Find Usages"))
# check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 49, "Rectangle {"),
ExpectedResult("color-animation.qml", 96, "Rectangle {"),
ExpectedResult("property-animation.qml", 48, "Rectangle {"),
ExpectedResult("property-animation.qml", 57, "Rectangle {")]
resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView")
test.verify(checkUsages(resultsView, expectedResults), "Verifying if usages were properly found using context menu.")
# clear previous results & prepare for next search
clickButton(waitForObject(":Qt Creator.Clear_QToolButton"))
mouseClick(editorArea, 5, 5, 0, Qt.LeftButton)
# 2. check usages using menu
# place cursor to component
if not placeCursorToLine(editorArea, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"):
invokeMenuItem("File", "Exit")
return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 87)
invokeMenuItem("Tools", "QML/JS", "Find Usages")
# check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 50, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"),
ExpectedResult("color-animation.qml", 97, "anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }"),
ExpectedResult("property-animation.qml", 49, "anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }"),
ExpectedResult("property-animation.qml", 58, "anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }")]
resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView")
test.verify(checkUsages(resultsView, expectedResults), "Verifying if usages were properly found using main menu.")
# clear previous results & prepare for next search
clickButton(waitForObject(":Qt Creator.Clear_QToolButton"))
mouseClick(editorArea, 5, 5, 0, Qt.LeftButton)
# 3. check usages using keyboard shortcut
# place cursor to component
if not placeCursorToLine(editorArea, "SequentialAnimation on opacity {"):
invokeMenuItem("File", "Exit")
return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
type(editorArea, "<Ctrl+Shift+U>")
# check if usage was properly found
expectedResults = [ExpectedResult("color-animation.qml", 87, "SequentialAnimation on opacity {")]
resultsView = waitForObject(":Qt Creator_Find::Internal::SearchResultTreeView")
test.verify(checkUsages(resultsView, expectedResults), "Verifying if usages were properly found using shortcut.")
#save and exit
invokeMenuItem("File", "Exit")

View File

@@ -0,0 +1,59 @@
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
def main():
startApplication("qtcreator" + SettingsPath)
# create qt quick application
projectDir = tempDir()
createNewQtQuickApplication(projectDir, "SampleApp")
# open qml file
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
# get editor
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# place cursor to component
if not placeCursorToLine(editorArea, "Text {"):
invokeMenuItem("File", "Exit")
return
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 5)
# invoke Refactoring - Move Component into separate file
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Move Component into separate file"))
# give component name and proceed
replaceEditorContent(waitForObject(":Dialog.componentNameEdit_QLineEdit"), "MyComponent")
clickButton(waitForObject(":Dialog.OK_QPushButton"))
# verify if refactoring is done correctly
waitFor("'MyComponent' in str(editorArea.plainText)", 2000)
codeText = str(editorArea.plainText)
patternCodeToAdd = "MyComponent\s+\{\s*\}"
patternCodeToMove = "Text\s+\{.*\}"
# there should be empty MyComponent item instead of Text item
if re.search(patternCodeToAdd, codeText, re.DOTALL) and not re.search(patternCodeToMove, codeText, re.DOTALL):
test.passes("Refactoring was properly applied in source file")
else:
test.fail("Refactoring of Text to MyComponent failed in source file. Content of editor:\n%s" % codeText)
# there should be new QML file generated with name "MyComponent.qml"
try:
waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.MyComponent\\.qml", 3000)
test.passes("Refactoring - file MyComponent.qml was generated properly in project explorer")
except:
test.fail("Refactoring failed - file MyComponent.qml was not generated properly in project explorer")
#save and exit
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")
# select MyComponent.qml file
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.MyComponent\\.qml", 5, 5, 0, Qt.LeftButton)
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
codeText = str(editorArea.plainText)
# there should be Text item in new file
if re.search(patternCodeToMove, codeText, re.DOTALL):
test.passes("Refactoring was properly applied to destination file")
else:
test.fail("Refactoring failed in destination file. Content of editor:\n%s" % codeText)
#save and exit
invokeMenuItem("File", "Save All")
# check if new file was created in file system
test.verify(os.path.exists(projectDir + "/SampleApp/qml/SampleApp/MyComponent.qml"),
"Verifying if MyComponent.qml exists in file system after save")
invokeMenuItem("File", "Exit")

View File

@@ -0,0 +1,49 @@
source("../../shared/qtcreator.py")
source("../../shared/suites_qtta.py")
def verifyCurrentLine(editorArea, currentLineExpectedText):
verifyMessage = "Verifying split initializer functionality at element line."
currentLineText = str(lineUnderCursor(editorArea)).strip();
return test.compare(currentLineText, currentLineExpectedText, verifyMessage)
def main():
startApplication("qtcreator" + SettingsPath)
# create qt quick application
createNewQtQuickApplication(tempDir(), "SampleApp")
# open qml file
doubleClickItem(":Qt Creator_Utils::NavigationTreeView", "SampleApp.QML.qml/SampleApp.main\\.qml", 5, 5, 0, Qt.LeftButton)
# get editor
editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget")
# prepare code for test - type one-line element
if not placeCursorToLine(editorArea, "Text {"):
invokeMenuItem("File", "Exit")
return
moveTextCursor(editorArea, QTextCursor.StartOfLine, QTextCursor.MoveAnchor)
type(editorArea, "<Return>")
moveTextCursor(editorArea, QTextCursor.Up, QTextCursor.MoveAnchor)
type(editorArea, "<Tab>")
type(editorArea, "Item { x: 10; y: 20; width: 10 }")
moveTextCursor(editorArea, QTextCursor.Left, QTextCursor.MoveAnchor, 30)
invokeMenuItem("File", "Save All")
# activate menu and apply 'Refactoring - Split initializer'
numLinesExpected = len(str(editorArea.plainText).splitlines()) + 4
ctxtMenu = openContextMenuOnTextCursorPosition(editorArea)
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Refactoring"))
activateItem(waitForObjectItem(objectMap.realName(ctxtMenu), "Split initializer"))
# wait until refactoring ended
waitFor("len(str(editorArea.plainText).splitlines()) == numLinesExpected", 5000)
# verify if refactoring was properly applied - each part on separate line
verifyCurrentLine(editorArea, "Item {")
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "x: 10;")
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "y: 20;")
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "width: 10")
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
verifyCurrentLine(editorArea, "}")
moveTextCursor(editorArea, QTextCursor.Down, QTextCursor.MoveAnchor, 1)
#save and exit
invokeMenuItem("File", "Save All")
invokeMenuItem("File", "Exit")