forked from qt-creator/qt-creator
QmlJSInspector: Fix whitespace issues
Change-Id: I5dba3ffcad7cdcd45dc6e2e81dce13fc181e27cf Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -91,23 +91,23 @@ void ClientProxy::connectToServer()
|
||||
SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)),
|
||||
this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status)));
|
||||
connect(m_inspectorClient, SIGNAL(currentObjectsChanged(QList<int>)),
|
||||
SLOT(onCurrentObjectsChanged(QList<int>)));
|
||||
SLOT(onCurrentObjectsChanged(QList<int>)));
|
||||
connect(m_inspectorClient, SIGNAL(zoomToolActivated()),
|
||||
SIGNAL(zoomToolActivated()));
|
||||
SIGNAL(zoomToolActivated()));
|
||||
connect(m_inspectorClient, SIGNAL(selectToolActivated()),
|
||||
SIGNAL(selectToolActivated()));
|
||||
SIGNAL(selectToolActivated()));
|
||||
connect(m_inspectorClient, SIGNAL(selectMarqueeToolActivated()),
|
||||
SIGNAL(selectMarqueeToolActivated()));
|
||||
SIGNAL(selectMarqueeToolActivated()));
|
||||
connect(m_inspectorClient, SIGNAL(animationSpeedChanged(qreal)),
|
||||
SIGNAL(animationSpeedChanged(qreal)));
|
||||
SIGNAL(animationSpeedChanged(qreal)));
|
||||
connect(m_inspectorClient, SIGNAL(animationPausedChanged(bool)),
|
||||
SIGNAL(animationPausedChanged(bool)));
|
||||
SIGNAL(animationPausedChanged(bool)));
|
||||
connect(m_inspectorClient, SIGNAL(designModeBehaviorChanged(bool)),
|
||||
SIGNAL(designModeBehaviorChanged(bool)));
|
||||
SIGNAL(designModeBehaviorChanged(bool)));
|
||||
connect(m_inspectorClient, SIGNAL(showAppOnTopChanged(bool)),
|
||||
SIGNAL(showAppOnTopChanged(bool)));
|
||||
SIGNAL(showAppOnTopChanged(bool)));
|
||||
connect(m_inspectorClient, SIGNAL(reloaded()), this,
|
||||
SIGNAL(serverReloaded()));
|
||||
SIGNAL(serverReloaded()));
|
||||
connect(m_inspectorClient, SIGNAL(logActivity(QString,QString)),
|
||||
m_adapter.data(), SLOT(logServiceActivity(QString,QString)));
|
||||
|
||||
@@ -337,11 +337,11 @@ ClientProxy::objectReferences(const QmlDebugObjectReference &objectRef) const
|
||||
}
|
||||
|
||||
quint32 ClientProxy::setBindingForObject(int objectDebugId,
|
||||
const QString &propertyName,
|
||||
const QVariant &value,
|
||||
bool isLiteralValue,
|
||||
QString source,
|
||||
int line)
|
||||
const QString &propertyName,
|
||||
const QVariant &value,
|
||||
bool isLiteralValue,
|
||||
QString source,
|
||||
int line)
|
||||
{
|
||||
if (objectDebugId == -1)
|
||||
return false;
|
||||
|
||||
@@ -61,11 +61,11 @@ public:
|
||||
~ClientProxy();
|
||||
|
||||
quint32 setBindingForObject(int objectDebugId,
|
||||
const QString &propertyName,
|
||||
const QVariant &value,
|
||||
bool isLiteralValue,
|
||||
QString source,
|
||||
int line);
|
||||
const QString &propertyName,
|
||||
const QVariant &value,
|
||||
bool isLiteralValue,
|
||||
QString source,
|
||||
int line);
|
||||
|
||||
quint32 setMethodBodyForObject(int objectDebugId, const QString &methodName, const QString &methodBody);
|
||||
quint32 resetBindingForObject(int objectDebugId, const QString &propertyName);
|
||||
|
||||
@@ -331,7 +331,7 @@ void InspectorUi::connected(ClientProxy *clientProxy)
|
||||
m_clientProxy = clientProxy;
|
||||
if (m_clientProxy)
|
||||
connect(m_clientProxy, SIGNAL(result(quint32,QVariant)),
|
||||
SLOT(onResult(quint32,QVariant)));
|
||||
SLOT(onResult(quint32,QVariant)));
|
||||
using namespace QmlJsDebugClient::Constants;
|
||||
if (m_clientProxy->qmlDebugger()->objectName() == QML_DEBUGGER &&
|
||||
m_clientProxy->qmlDebugger()->serviceVersion() >= CURRENT_SUPPORTED_VERSION)
|
||||
@@ -390,7 +390,7 @@ void InspectorUi::onRootContext(const QVariant &value)
|
||||
m_clientProxy->fetchRootObjects(
|
||||
qvariant_cast<QmlDebugContextReference>(
|
||||
value), true);
|
||||
} else {
|
||||
} else {
|
||||
for (int i = 1; i < m_crumblePath->length(); i++) {
|
||||
m_updateObjectQueryIds << m_clientProxy->fetchContextObject(
|
||||
m_crumblePath->dataForIndex(i).toInt());
|
||||
@@ -413,7 +413,7 @@ void InspectorUi::updateEngineList()
|
||||
{
|
||||
QList<QmlDebugEngineReference> engines = m_clientProxy->engines();
|
||||
|
||||
//#warning update the QML engines combo
|
||||
//#warning update the QML engines combo
|
||||
|
||||
if (engines.isEmpty())
|
||||
qWarning("qmldebugger: no engines found!");
|
||||
@@ -780,7 +780,7 @@ void InspectorUi::gotoObjectReferenceDefinition(const QmlDebugObjectReference &o
|
||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
|
||||
|
||||
if (currentEditor != editor)
|
||||
m_selectionCallbackExpected = true;
|
||||
m_selectionCallbackExpected = true;
|
||||
|
||||
if (textEditor) {
|
||||
QmlDebugObjectReference ref = objectReferenceForLocation(fileName);
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace QmlJSInspector {
|
||||
namespace Internal {
|
||||
|
||||
QmlJSInspectorClient::QmlJSInspectorClient(QDeclarativeDebugConnection *client,
|
||||
QObject * /*parent*/)
|
||||
QObject * /*parent*/)
|
||||
: QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) ,
|
||||
m_connection(client)
|
||||
m_connection(client)
|
||||
{
|
||||
setObjectName(name());
|
||||
}
|
||||
@@ -358,7 +358,7 @@ void QmlJSInspectorClient::showAppOnTop(bool showOnTop)
|
||||
}
|
||||
|
||||
void QmlJSInspectorClient::createQmlObject(const QString &qmlText, int parentDebugId,
|
||||
const QStringList &imports, const QString &filename, int order)
|
||||
const QStringList &imports, const QString &filename, int order)
|
||||
{
|
||||
if (!m_connection || !m_connection->isConnected())
|
||||
return;
|
||||
@@ -431,7 +431,7 @@ void QmlJSInspectorClient::applyChangesFromQmlFile()
|
||||
}
|
||||
|
||||
void QmlJSInspectorClient::log(LogDirection direction, InspectorProtocol::Message message,
|
||||
const QString &extra)
|
||||
const QString &extra)
|
||||
{
|
||||
QString msg;
|
||||
if (direction == LogSend)
|
||||
|
||||
@@ -44,7 +44,7 @@ class QmlJSInspectorClient : public QDeclarativeDebugClient
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QmlJSInspectorClient(QDeclarativeDebugConnection *client,
|
||||
QObject *parent = 0);
|
||||
QObject *parent = 0);
|
||||
|
||||
void setCurrentObjects(const QList<int> &debugIds);
|
||||
void reloadViewer();
|
||||
|
||||
@@ -145,7 +145,7 @@ void InspectorPlugin::modeAboutToChange(Core::IMode *newMode)
|
||||
|
||||
// Make sure we're not called again.
|
||||
QObject::disconnect(Core::ModeManager::instance(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
|
||||
this, SLOT(modeAboutToChange(Core::IMode*)));
|
||||
this, SLOT(modeAboutToChange(Core::IMode*)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,24 +68,24 @@ namespace Internal {
|
||||
*/
|
||||
class MapObjectWithDebugReference : public Visitor
|
||||
{
|
||||
public:
|
||||
typedef QList<int> DebugIdList;
|
||||
MapObjectWithDebugReference() : activated(0) {}
|
||||
virtual void endVisit(UiObjectDefinition *ast) ;
|
||||
virtual void endVisit(UiObjectBinding *ast) ;
|
||||
virtual bool visit(UiObjectDefinition *ast) ;
|
||||
virtual bool visit(UiObjectBinding *ast) ;
|
||||
public:
|
||||
typedef QList<int> DebugIdList;
|
||||
MapObjectWithDebugReference() : activated(0) {}
|
||||
virtual void endVisit(UiObjectDefinition *ast) ;
|
||||
virtual void endVisit(UiObjectBinding *ast) ;
|
||||
virtual bool visit(UiObjectDefinition *ast) ;
|
||||
virtual bool visit(UiObjectBinding *ast) ;
|
||||
|
||||
QHash<QPair<int, int>, DebugIdList> ids;
|
||||
QString filename;
|
||||
QHash<UiObjectMember *, DebugIdList> result;
|
||||
QSet<UiObjectMember *> lookupObjects;
|
||||
QHash<QPair<int, int>, DebugIdList> ids;
|
||||
QString filename;
|
||||
QHash<UiObjectMember *, DebugIdList> result;
|
||||
QSet<UiObjectMember *> lookupObjects;
|
||||
|
||||
private:
|
||||
void process(UiObjectMember *ast);
|
||||
void process(UiObjectBinding *ast);
|
||||
private:
|
||||
int activated;
|
||||
private:
|
||||
void process(UiObjectMember *ast);
|
||||
void process(UiObjectBinding *ast);
|
||||
private:
|
||||
int activated;
|
||||
};
|
||||
|
||||
bool MapObjectWithDebugReference::visit(UiObjectDefinition* ast)
|
||||
@@ -270,8 +270,8 @@ void QmlJSLiveTextPreview::changeSelectedElements(QList<int> offsets, const QStr
|
||||
|
||||
// fallback: use ref under cursor if nothing else is found
|
||||
if (selectedReferences.isEmpty()
|
||||
&& !containsReferenceUnderCursor
|
||||
&& objectRefUnderCursor.debugId() != -1)
|
||||
&& !containsReferenceUnderCursor
|
||||
&& objectRefUnderCursor.debugId() != -1)
|
||||
{
|
||||
selectedReferences << objectRefUnderCursor.debugId();
|
||||
}
|
||||
@@ -343,7 +343,7 @@ void QmlJSLiveTextPreview::updateDebugIds()
|
||||
const QmlJS::Document::Ptr &doc = it.key();
|
||||
|
||||
DebugIdHash::const_iterator id_it = clientProxy->debugIdHash().constFind(
|
||||
qMakePair<QString, int>(doc->fileName(), doc->editorRevision()));
|
||||
qMakePair<QString, int>(doc->fileName(), doc->editorRevision()));
|
||||
if (id_it == clientProxy->debugIdHash().constEnd())
|
||||
continue;
|
||||
|
||||
@@ -442,21 +442,21 @@ private:
|
||||
ExpressionStatement *expStatement = cast<ExpressionStatement*>(scriptBinding->statement);
|
||||
|
||||
switch(expStatement->expression->kind) {
|
||||
case Node::Kind_NumericLiteral:
|
||||
case Node::Kind_UnaryPlusExpression:
|
||||
case Node::Kind_UnaryMinusExpression:
|
||||
castedExpression = QVariant(cleanedValue).toReal();
|
||||
break;
|
||||
case Node::Kind_StringLiteral:
|
||||
castedExpression = QVariant(cleanedValue).toString();
|
||||
break;
|
||||
case Node::Kind_TrueLiteral:
|
||||
case Node::Kind_FalseLiteral:
|
||||
castedExpression = QVariant(cleanedValue).toBool();
|
||||
break;
|
||||
default:
|
||||
castedExpression = cleanedValue;
|
||||
break;
|
||||
case Node::Kind_NumericLiteral:
|
||||
case Node::Kind_UnaryPlusExpression:
|
||||
case Node::Kind_UnaryMinusExpression:
|
||||
castedExpression = QVariant(cleanedValue).toReal();
|
||||
break;
|
||||
case Node::Kind_StringLiteral:
|
||||
castedExpression = QVariant(cleanedValue).toString();
|
||||
break;
|
||||
case Node::Kind_TrueLiteral:
|
||||
case Node::Kind_FalseLiteral:
|
||||
castedExpression = QVariant(cleanedValue).toBool();
|
||||
break;
|
||||
default:
|
||||
castedExpression = cleanedValue;
|
||||
break;
|
||||
}
|
||||
|
||||
return castedExpression;
|
||||
@@ -510,7 +510,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual void createObject(const QString& qmlText, DebugId ref,
|
||||
const QStringList& importList, const QString& filename, int order)
|
||||
const QStringList& importList, const QString& filename, int order)
|
||||
{
|
||||
appliedChangesToViewer = true;
|
||||
referenceRefreshRequired = true;
|
||||
@@ -528,7 +528,7 @@ protected:
|
||||
if (unsyncronizableChanges == QmlJSLiveTextPreview::NoUnsyncronizableChanges) {
|
||||
UiObjectDefinition *parentDefinition = cast<UiObjectDefinition *>(parent);
|
||||
if (parentDefinition && parentDefinition->qualifiedTypeNameId
|
||||
&& !parentDefinition->qualifiedTypeNameId->name.isEmpty())
|
||||
&& !parentDefinition->qualifiedTypeNameId->name.isEmpty())
|
||||
{
|
||||
unsyncronizableElementName = parentDefinition->qualifiedTypeNameId->name.toString();
|
||||
unsyncronizableChanges = QmlJSLiveTextPreview::ElementChangeWarning;
|
||||
@@ -568,7 +568,7 @@ void QmlJSLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
||||
m_docWithUnappliedChanges.clear();
|
||||
|
||||
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()
|
||||
&& doc->qmlProgram() && m_previousDoc->qmlProgram())
|
||||
&& doc->qmlProgram() && m_previousDoc->qmlProgram())
|
||||
{
|
||||
UpdateInspector delta(m_clientProxy.data());
|
||||
m_debugIds = delta(m_previousDoc, doc, m_debugIds);
|
||||
@@ -602,9 +602,9 @@ void QmlJSLiveTextPreview::showExperimentalWarning()
|
||||
foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editor, m_editors)
|
||||
if (editor) {
|
||||
Core::InfoBarEntry info(
|
||||
Constants::INFO_EXPERIMENTAL,
|
||||
tr("You changed a QML file in Live Preview mode, which modifies the running QML application. "
|
||||
"In case of unexpected behavior, please reload the QML application."));
|
||||
Constants::INFO_EXPERIMENTAL,
|
||||
tr("You changed a QML file in Live Preview mode, which modifies the running QML application. "
|
||||
"In case of unexpected behavior, please reload the QML application."));
|
||||
info.setCustomButtonInfo(tr("Disable Live Preview"), this, SLOT(disableLivePreview()));
|
||||
editor.data()->editorDocument()->infoBar()->addInfo(info);
|
||||
}
|
||||
@@ -615,17 +615,17 @@ void QmlJSLiveTextPreview::showSyncWarning(UnsyncronizableChangeType unsyncroniz
|
||||
{
|
||||
QString errorMessage;
|
||||
switch (unsyncronizableChangeType) {
|
||||
case AttributeChangeWarning:
|
||||
errorMessage = tr("The %1 attribute at line %2, column %3 cannot be changed without reloading the QML application. ")
|
||||
.arg(elementName, QString::number(line), QString::number(column));
|
||||
break;
|
||||
case ElementChangeWarning:
|
||||
errorMessage = tr("The %1 element at line %2, column %3 cannot be changed without reloading the QML application. ")
|
||||
.arg(elementName, QString::number(line), QString::number(column));
|
||||
break;
|
||||
case QmlJSLiveTextPreview::NoUnsyncronizableChanges:
|
||||
default:
|
||||
return;
|
||||
case AttributeChangeWarning:
|
||||
errorMessage = tr("The %1 attribute at line %2, column %3 cannot be changed without reloading the QML application. ")
|
||||
.arg(elementName, QString::number(line), QString::number(column));
|
||||
break;
|
||||
case ElementChangeWarning:
|
||||
errorMessage = tr("The %1 element at line %2, column %3 cannot be changed without reloading the QML application. ")
|
||||
.arg(elementName, QString::number(line), QString::number(column));
|
||||
break;
|
||||
case QmlJSLiveTextPreview::NoUnsyncronizableChanges:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
errorMessage.append(tr("You can continue debugging, but behavior can be unexpected."));
|
||||
@@ -633,7 +633,7 @@ void QmlJSLiveTextPreview::showSyncWarning(UnsyncronizableChangeType unsyncroniz
|
||||
foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editor, m_editors)
|
||||
if (editor)
|
||||
editor.data()->editorDocument()->infoBar()->addInfo(Core::InfoBarEntry(
|
||||
QLatin1String(Constants::INFO_OUT_OF_SYNC), errorMessage));
|
||||
QLatin1String(Constants::INFO_OUT_OF_SYNC), errorMessage));
|
||||
}
|
||||
|
||||
void QmlJSLiveTextPreview::reloadQmlViewer()
|
||||
@@ -675,7 +675,7 @@ void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy)
|
||||
|
||||
if (m_clientProxy.data()) {
|
||||
connect(m_clientProxy.data(), SIGNAL(objectTreeUpdated()),
|
||||
SLOT(updateDebugIds()));
|
||||
SLOT(updateDebugIds()));
|
||||
|
||||
foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editWidget, m_editors)
|
||||
if (editWidget)
|
||||
|
||||
@@ -44,11 +44,11 @@
|
||||
QT_FORWARD_DECLARE_CLASS(QTextDocument)
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IEditor;
|
||||
}
|
||||
|
||||
namespace QmlJS {
|
||||
class ModelManagerInterface;
|
||||
class ModelManagerInterface;
|
||||
}
|
||||
|
||||
namespace QmlJSInspector {
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Internal {
|
||||
|
||||
class PropertyEditDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
public:
|
||||
explicit PropertyEditDelegate(QObject *parent=0) : QItemDelegate(parent),
|
||||
m_treeWidget(dynamic_cast<QmlJSPropertyInspector *>(parent)) {}
|
||||
|
||||
@@ -74,24 +74,24 @@ class PropertyEditDelegate : public QItemDelegate
|
||||
|
||||
switch (m_treeWidget->getTypeFor(index.row())) {
|
||||
|
||||
case QmlJSPropertyInspector::BooleanType: {
|
||||
// invert the bool, skip editor
|
||||
int objectId = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::UserRole).toInt();
|
||||
QString propertyName = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::DisplayRole).toString();
|
||||
bool propertyValue = m_treeWidget->getData(index.row(), PROPERTY_VALUE_COLUMN, Qt::DisplayRole).toBool();
|
||||
m_treeWidget->propertyValueEdited(objectId, propertyName, !propertyValue?"true":"false", true);
|
||||
return 0;
|
||||
}
|
||||
case QmlJSPropertyInspector::BooleanType: {
|
||||
// invert the bool, skip editor
|
||||
int objectId = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::UserRole).toInt();
|
||||
QString propertyName = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::DisplayRole).toString();
|
||||
bool propertyValue = m_treeWidget->getData(index.row(), PROPERTY_VALUE_COLUMN, Qt::DisplayRole).toBool();
|
||||
m_treeWidget->propertyValueEdited(objectId, propertyName, !propertyValue?"true":"false", true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case QmlJSPropertyInspector::NumberType: {
|
||||
QLineEdit *editor = new QLineEdit(parent);
|
||||
editor->setValidator(new QDoubleValidator(editor));
|
||||
return editor;
|
||||
}
|
||||
case QmlJSPropertyInspector::NumberType: {
|
||||
QLineEdit *editor = new QLineEdit(parent);
|
||||
editor->setValidator(new QDoubleValidator(editor));
|
||||
return editor;
|
||||
}
|
||||
|
||||
default: {
|
||||
return new QLineEdit(parent);
|
||||
}
|
||||
return new QLineEdit(parent);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -257,9 +257,9 @@ QVariant QmlJSPropertyInspectorModel::headerData(int section, Qt::Orientation or
|
||||
{
|
||||
if (orient == Qt::Horizontal && role == Qt::DisplayRole) {
|
||||
switch (section) {
|
||||
case PROPERTY_NAME_COLUMN: return tr("Name");
|
||||
case PROPERTY_VALUE_COLUMN: return tr("Value");
|
||||
case PROPERTY_TYPE_COLUMN: return tr("Type");
|
||||
case PROPERTY_NAME_COLUMN: return tr("Name");
|
||||
case PROPERTY_VALUE_COLUMN: return tr("Value");
|
||||
case PROPERTY_TYPE_COLUMN: return tr("Type");
|
||||
};
|
||||
}
|
||||
return QStandardItemModel::headerData(section, orient, role);
|
||||
@@ -405,7 +405,7 @@ void QmlJSPropertyInspector::buildPropertyTree(const QmlDebugObjectReference &ob
|
||||
}
|
||||
|
||||
void QmlJSPropertyInspector::addRow(const QString &name,const QString &value, const QString &type,
|
||||
const int debugId, bool editable)
|
||||
const int debugId, bool editable)
|
||||
{
|
||||
QStandardItem *nameColumn = new QStandardItem(name);
|
||||
nameColumn->setToolTip(name);
|
||||
|
||||
Reference in New Issue
Block a user