QmlJSInspector: Fix whitespace issues

Change-Id: I5dba3ffcad7cdcd45dc6e2e81dce13fc181e27cf
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Kai Koehne
2012-04-16 17:09:27 +02:00
parent c46221ee9a
commit 684b37fece
9 changed files with 104 additions and 104 deletions

View File

@@ -91,23 +91,23 @@ void ClientProxy::connectToServer()
SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)), SIGNAL(connectedStatusChanged(QDeclarativeDebugClient::Status)),
this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status))); this, SLOT(clientStatusChanged(QDeclarativeDebugClient::Status)));
connect(m_inspectorClient, SIGNAL(currentObjectsChanged(QList<int>)), connect(m_inspectorClient, SIGNAL(currentObjectsChanged(QList<int>)),
SLOT(onCurrentObjectsChanged(QList<int>))); SLOT(onCurrentObjectsChanged(QList<int>)));
connect(m_inspectorClient, SIGNAL(zoomToolActivated()), connect(m_inspectorClient, SIGNAL(zoomToolActivated()),
SIGNAL(zoomToolActivated())); SIGNAL(zoomToolActivated()));
connect(m_inspectorClient, SIGNAL(selectToolActivated()), connect(m_inspectorClient, SIGNAL(selectToolActivated()),
SIGNAL(selectToolActivated())); SIGNAL(selectToolActivated()));
connect(m_inspectorClient, SIGNAL(selectMarqueeToolActivated()), connect(m_inspectorClient, SIGNAL(selectMarqueeToolActivated()),
SIGNAL(selectMarqueeToolActivated())); SIGNAL(selectMarqueeToolActivated()));
connect(m_inspectorClient, SIGNAL(animationSpeedChanged(qreal)), connect(m_inspectorClient, SIGNAL(animationSpeedChanged(qreal)),
SIGNAL(animationSpeedChanged(qreal))); SIGNAL(animationSpeedChanged(qreal)));
connect(m_inspectorClient, SIGNAL(animationPausedChanged(bool)), connect(m_inspectorClient, SIGNAL(animationPausedChanged(bool)),
SIGNAL(animationPausedChanged(bool))); SIGNAL(animationPausedChanged(bool)));
connect(m_inspectorClient, SIGNAL(designModeBehaviorChanged(bool)), connect(m_inspectorClient, SIGNAL(designModeBehaviorChanged(bool)),
SIGNAL(designModeBehaviorChanged(bool))); SIGNAL(designModeBehaviorChanged(bool)));
connect(m_inspectorClient, SIGNAL(showAppOnTopChanged(bool)), connect(m_inspectorClient, SIGNAL(showAppOnTopChanged(bool)),
SIGNAL(showAppOnTopChanged(bool))); SIGNAL(showAppOnTopChanged(bool)));
connect(m_inspectorClient, SIGNAL(reloaded()), this, connect(m_inspectorClient, SIGNAL(reloaded()), this,
SIGNAL(serverReloaded())); SIGNAL(serverReloaded()));
connect(m_inspectorClient, SIGNAL(logActivity(QString,QString)), connect(m_inspectorClient, SIGNAL(logActivity(QString,QString)),
m_adapter.data(), SLOT(logServiceActivity(QString,QString))); m_adapter.data(), SLOT(logServiceActivity(QString,QString)));
@@ -337,11 +337,11 @@ ClientProxy::objectReferences(const QmlDebugObjectReference &objectRef) const
} }
quint32 ClientProxy::setBindingForObject(int objectDebugId, quint32 ClientProxy::setBindingForObject(int objectDebugId,
const QString &propertyName, const QString &propertyName,
const QVariant &value, const QVariant &value,
bool isLiteralValue, bool isLiteralValue,
QString source, QString source,
int line) int line)
{ {
if (objectDebugId == -1) if (objectDebugId == -1)
return false; return false;

View File

@@ -61,11 +61,11 @@ public:
~ClientProxy(); ~ClientProxy();
quint32 setBindingForObject(int objectDebugId, quint32 setBindingForObject(int objectDebugId,
const QString &propertyName, const QString &propertyName,
const QVariant &value, const QVariant &value,
bool isLiteralValue, bool isLiteralValue,
QString source, QString source,
int line); int line);
quint32 setMethodBodyForObject(int objectDebugId, const QString &methodName, const QString &methodBody); quint32 setMethodBodyForObject(int objectDebugId, const QString &methodName, const QString &methodBody);
quint32 resetBindingForObject(int objectDebugId, const QString &propertyName); quint32 resetBindingForObject(int objectDebugId, const QString &propertyName);

View File

@@ -331,7 +331,7 @@ void InspectorUi::connected(ClientProxy *clientProxy)
m_clientProxy = clientProxy; m_clientProxy = clientProxy;
if (m_clientProxy) if (m_clientProxy)
connect(m_clientProxy, SIGNAL(result(quint32,QVariant)), connect(m_clientProxy, SIGNAL(result(quint32,QVariant)),
SLOT(onResult(quint32,QVariant))); SLOT(onResult(quint32,QVariant)));
using namespace QmlJsDebugClient::Constants; using namespace QmlJsDebugClient::Constants;
if (m_clientProxy->qmlDebugger()->objectName() == QML_DEBUGGER && if (m_clientProxy->qmlDebugger()->objectName() == QML_DEBUGGER &&
m_clientProxy->qmlDebugger()->serviceVersion() >= CURRENT_SUPPORTED_VERSION) m_clientProxy->qmlDebugger()->serviceVersion() >= CURRENT_SUPPORTED_VERSION)
@@ -390,7 +390,7 @@ void InspectorUi::onRootContext(const QVariant &value)
m_clientProxy->fetchRootObjects( m_clientProxy->fetchRootObjects(
qvariant_cast<QmlDebugContextReference>( qvariant_cast<QmlDebugContextReference>(
value), true); value), true);
} else { } else {
for (int i = 1; i < m_crumblePath->length(); i++) { for (int i = 1; i < m_crumblePath->length(); i++) {
m_updateObjectQueryIds << m_clientProxy->fetchContextObject( m_updateObjectQueryIds << m_clientProxy->fetchContextObject(
m_crumblePath->dataForIndex(i).toInt()); m_crumblePath->dataForIndex(i).toInt());
@@ -413,7 +413,7 @@ void InspectorUi::updateEngineList()
{ {
QList<QmlDebugEngineReference> engines = m_clientProxy->engines(); QList<QmlDebugEngineReference> engines = m_clientProxy->engines();
//#warning update the QML engines combo //#warning update the QML engines combo
if (engines.isEmpty()) if (engines.isEmpty())
qWarning("qmldebugger: no engines found!"); qWarning("qmldebugger: no engines found!");
@@ -780,7 +780,7 @@ void InspectorUi::gotoObjectReferenceDefinition(const QmlDebugObjectReference &o
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor); TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor);
if (currentEditor != editor) if (currentEditor != editor)
m_selectionCallbackExpected = true; m_selectionCallbackExpected = true;
if (textEditor) { if (textEditor) {
QmlDebugObjectReference ref = objectReferenceForLocation(fileName); QmlDebugObjectReference ref = objectReferenceForLocation(fileName);

View File

@@ -39,9 +39,9 @@ namespace QmlJSInspector {
namespace Internal { namespace Internal {
QmlJSInspectorClient::QmlJSInspectorClient(QDeclarativeDebugConnection *client, QmlJSInspectorClient::QmlJSInspectorClient(QDeclarativeDebugConnection *client,
QObject * /*parent*/) QObject * /*parent*/)
: QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) , : QDeclarativeDebugClient(QLatin1String("QDeclarativeObserverMode"), client) ,
m_connection(client) m_connection(client)
{ {
setObjectName(name()); setObjectName(name());
} }
@@ -358,7 +358,7 @@ void QmlJSInspectorClient::showAppOnTop(bool showOnTop)
} }
void QmlJSInspectorClient::createQmlObject(const QString &qmlText, int parentDebugId, 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()) if (!m_connection || !m_connection->isConnected())
return; return;
@@ -431,7 +431,7 @@ void QmlJSInspectorClient::applyChangesFromQmlFile()
} }
void QmlJSInspectorClient::log(LogDirection direction, InspectorProtocol::Message message, void QmlJSInspectorClient::log(LogDirection direction, InspectorProtocol::Message message,
const QString &extra) const QString &extra)
{ {
QString msg; QString msg;
if (direction == LogSend) if (direction == LogSend)

View File

@@ -44,7 +44,7 @@ class QmlJSInspectorClient : public QDeclarativeDebugClient
Q_OBJECT Q_OBJECT
public: public:
explicit QmlJSInspectorClient(QDeclarativeDebugConnection *client, explicit QmlJSInspectorClient(QDeclarativeDebugConnection *client,
QObject *parent = 0); QObject *parent = 0);
void setCurrentObjects(const QList<int> &debugIds); void setCurrentObjects(const QList<int> &debugIds);
void reloadViewer(); void reloadViewer();

View File

@@ -145,7 +145,7 @@ void InspectorPlugin::modeAboutToChange(Core::IMode *newMode)
// Make sure we're not called again. // Make sure we're not called again.
QObject::disconnect(Core::ModeManager::instance(), SIGNAL(currentModeAboutToChange(Core::IMode*)), QObject::disconnect(Core::ModeManager::instance(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
this, SLOT(modeAboutToChange(Core::IMode*))); this, SLOT(modeAboutToChange(Core::IMode*)));
} }
} }

View File

@@ -68,24 +68,24 @@ namespace Internal {
*/ */
class MapObjectWithDebugReference : public Visitor class MapObjectWithDebugReference : public Visitor
{ {
public: public:
typedef QList<int> DebugIdList; typedef QList<int> DebugIdList;
MapObjectWithDebugReference() : activated(0) {} MapObjectWithDebugReference() : activated(0) {}
virtual void endVisit(UiObjectDefinition *ast) ; virtual void endVisit(UiObjectDefinition *ast) ;
virtual void endVisit(UiObjectBinding *ast) ; virtual void endVisit(UiObjectBinding *ast) ;
virtual bool visit(UiObjectDefinition *ast) ; virtual bool visit(UiObjectDefinition *ast) ;
virtual bool visit(UiObjectBinding *ast) ; virtual bool visit(UiObjectBinding *ast) ;
QHash<QPair<int, int>, DebugIdList> ids; QHash<QPair<int, int>, DebugIdList> ids;
QString filename; QString filename;
QHash<UiObjectMember *, DebugIdList> result; QHash<UiObjectMember *, DebugIdList> result;
QSet<UiObjectMember *> lookupObjects; QSet<UiObjectMember *> lookupObjects;
private: private:
void process(UiObjectMember *ast); void process(UiObjectMember *ast);
void process(UiObjectBinding *ast); void process(UiObjectBinding *ast);
private: private:
int activated; int activated;
}; };
bool MapObjectWithDebugReference::visit(UiObjectDefinition* ast) 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 // fallback: use ref under cursor if nothing else is found
if (selectedReferences.isEmpty() if (selectedReferences.isEmpty()
&& !containsReferenceUnderCursor && !containsReferenceUnderCursor
&& objectRefUnderCursor.debugId() != -1) && objectRefUnderCursor.debugId() != -1)
{ {
selectedReferences << objectRefUnderCursor.debugId(); selectedReferences << objectRefUnderCursor.debugId();
} }
@@ -343,7 +343,7 @@ void QmlJSLiveTextPreview::updateDebugIds()
const QmlJS::Document::Ptr &doc = it.key(); const QmlJS::Document::Ptr &doc = it.key();
DebugIdHash::const_iterator id_it = clientProxy->debugIdHash().constFind( 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()) if (id_it == clientProxy->debugIdHash().constEnd())
continue; continue;
@@ -442,21 +442,21 @@ private:
ExpressionStatement *expStatement = cast<ExpressionStatement*>(scriptBinding->statement); ExpressionStatement *expStatement = cast<ExpressionStatement*>(scriptBinding->statement);
switch(expStatement->expression->kind) { switch(expStatement->expression->kind) {
case Node::Kind_NumericLiteral: case Node::Kind_NumericLiteral:
case Node::Kind_UnaryPlusExpression: case Node::Kind_UnaryPlusExpression:
case Node::Kind_UnaryMinusExpression: case Node::Kind_UnaryMinusExpression:
castedExpression = QVariant(cleanedValue).toReal(); castedExpression = QVariant(cleanedValue).toReal();
break; break;
case Node::Kind_StringLiteral: case Node::Kind_StringLiteral:
castedExpression = QVariant(cleanedValue).toString(); castedExpression = QVariant(cleanedValue).toString();
break; break;
case Node::Kind_TrueLiteral: case Node::Kind_TrueLiteral:
case Node::Kind_FalseLiteral: case Node::Kind_FalseLiteral:
castedExpression = QVariant(cleanedValue).toBool(); castedExpression = QVariant(cleanedValue).toBool();
break; break;
default: default:
castedExpression = cleanedValue; castedExpression = cleanedValue;
break; break;
} }
return castedExpression; return castedExpression;
@@ -510,7 +510,7 @@ protected:
} }
virtual void createObject(const QString& qmlText, DebugId ref, 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; appliedChangesToViewer = true;
referenceRefreshRequired = true; referenceRefreshRequired = true;
@@ -528,7 +528,7 @@ protected:
if (unsyncronizableChanges == QmlJSLiveTextPreview::NoUnsyncronizableChanges) { if (unsyncronizableChanges == QmlJSLiveTextPreview::NoUnsyncronizableChanges) {
UiObjectDefinition *parentDefinition = cast<UiObjectDefinition *>(parent); UiObjectDefinition *parentDefinition = cast<UiObjectDefinition *>(parent);
if (parentDefinition && parentDefinition->qualifiedTypeNameId if (parentDefinition && parentDefinition->qualifiedTypeNameId
&& !parentDefinition->qualifiedTypeNameId->name.isEmpty()) && !parentDefinition->qualifiedTypeNameId->name.isEmpty())
{ {
unsyncronizableElementName = parentDefinition->qualifiedTypeNameId->name.toString(); unsyncronizableElementName = parentDefinition->qualifiedTypeNameId->name.toString();
unsyncronizableChanges = QmlJSLiveTextPreview::ElementChangeWarning; unsyncronizableChanges = QmlJSLiveTextPreview::ElementChangeWarning;
@@ -568,7 +568,7 @@ void QmlJSLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
m_docWithUnappliedChanges.clear(); m_docWithUnappliedChanges.clear();
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName() if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()
&& doc->qmlProgram() && m_previousDoc->qmlProgram()) && doc->qmlProgram() && m_previousDoc->qmlProgram())
{ {
UpdateInspector delta(m_clientProxy.data()); UpdateInspector delta(m_clientProxy.data());
m_debugIds = delta(m_previousDoc, doc, m_debugIds); m_debugIds = delta(m_previousDoc, doc, m_debugIds);
@@ -602,9 +602,9 @@ void QmlJSLiveTextPreview::showExperimentalWarning()
foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editor, m_editors) foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editor, m_editors)
if (editor) { if (editor) {
Core::InfoBarEntry info( Core::InfoBarEntry info(
Constants::INFO_EXPERIMENTAL, Constants::INFO_EXPERIMENTAL,
tr("You changed a QML file in Live Preview mode, which modifies the running QML application. " 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.")); "In case of unexpected behavior, please reload the QML application."));
info.setCustomButtonInfo(tr("Disable Live Preview"), this, SLOT(disableLivePreview())); info.setCustomButtonInfo(tr("Disable Live Preview"), this, SLOT(disableLivePreview()));
editor.data()->editorDocument()->infoBar()->addInfo(info); editor.data()->editorDocument()->infoBar()->addInfo(info);
} }
@@ -615,17 +615,17 @@ void QmlJSLiveTextPreview::showSyncWarning(UnsyncronizableChangeType unsyncroniz
{ {
QString errorMessage; QString errorMessage;
switch (unsyncronizableChangeType) { switch (unsyncronizableChangeType) {
case AttributeChangeWarning: case AttributeChangeWarning:
errorMessage = tr("The %1 attribute at line %2, column %3 cannot be changed without reloading the QML application. ") 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)); .arg(elementName, QString::number(line), QString::number(column));
break; break;
case ElementChangeWarning: case ElementChangeWarning:
errorMessage = tr("The %1 element at line %2, column %3 cannot be changed without reloading the QML application. ") 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)); .arg(elementName, QString::number(line), QString::number(column));
break; break;
case QmlJSLiveTextPreview::NoUnsyncronizableChanges: case QmlJSLiveTextPreview::NoUnsyncronizableChanges:
default: default:
return; return;
} }
errorMessage.append(tr("You can continue debugging, but behavior can be unexpected.")); 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) foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editor, m_editors)
if (editor) if (editor)
editor.data()->editorDocument()->infoBar()->addInfo(Core::InfoBarEntry( editor.data()->editorDocument()->infoBar()->addInfo(Core::InfoBarEntry(
QLatin1String(Constants::INFO_OUT_OF_SYNC), errorMessage)); QLatin1String(Constants::INFO_OUT_OF_SYNC), errorMessage));
} }
void QmlJSLiveTextPreview::reloadQmlViewer() void QmlJSLiveTextPreview::reloadQmlViewer()
@@ -675,7 +675,7 @@ void QmlJSLiveTextPreview::setClientProxy(ClientProxy *clientProxy)
if (m_clientProxy.data()) { if (m_clientProxy.data()) {
connect(m_clientProxy.data(), SIGNAL(objectTreeUpdated()), connect(m_clientProxy.data(), SIGNAL(objectTreeUpdated()),
SLOT(updateDebugIds())); SLOT(updateDebugIds()));
foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editWidget, m_editors) foreach (QWeakPointer<TextEditor::BaseTextEditorWidget> editWidget, m_editors)
if (editWidget) if (editWidget)

View File

@@ -44,11 +44,11 @@
QT_FORWARD_DECLARE_CLASS(QTextDocument) QT_FORWARD_DECLARE_CLASS(QTextDocument)
namespace Core { namespace Core {
class IEditor; class IEditor;
} }
namespace QmlJS { namespace QmlJS {
class ModelManagerInterface; class ModelManagerInterface;
} }
namespace QmlJSInspector { namespace QmlJSInspector {

View File

@@ -60,7 +60,7 @@ namespace Internal {
class PropertyEditDelegate : public QItemDelegate class PropertyEditDelegate : public QItemDelegate
{ {
public: public:
explicit PropertyEditDelegate(QObject *parent=0) : QItemDelegate(parent), explicit PropertyEditDelegate(QObject *parent=0) : QItemDelegate(parent),
m_treeWidget(dynamic_cast<QmlJSPropertyInspector *>(parent)) {} m_treeWidget(dynamic_cast<QmlJSPropertyInspector *>(parent)) {}
@@ -74,24 +74,24 @@ class PropertyEditDelegate : public QItemDelegate
switch (m_treeWidget->getTypeFor(index.row())) { switch (m_treeWidget->getTypeFor(index.row())) {
case QmlJSPropertyInspector::BooleanType: { case QmlJSPropertyInspector::BooleanType: {
// invert the bool, skip editor // invert the bool, skip editor
int objectId = m_treeWidget->getData(index.row(), PROPERTY_NAME_COLUMN, Qt::UserRole).toInt(); 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(); 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(); bool propertyValue = m_treeWidget->getData(index.row(), PROPERTY_VALUE_COLUMN, Qt::DisplayRole).toBool();
m_treeWidget->propertyValueEdited(objectId, propertyName, !propertyValue?"true":"false", true); m_treeWidget->propertyValueEdited(objectId, propertyName, !propertyValue?"true":"false", true);
return 0; return 0;
} }
case QmlJSPropertyInspector::NumberType: { case QmlJSPropertyInspector::NumberType: {
QLineEdit *editor = new QLineEdit(parent); QLineEdit *editor = new QLineEdit(parent);
editor->setValidator(new QDoubleValidator(editor)); editor->setValidator(new QDoubleValidator(editor));
return editor; return editor;
} }
default: { default: {
return new QLineEdit(parent); return new QLineEdit(parent);
} }
} }
return 0; return 0;
@@ -257,9 +257,9 @@ QVariant QmlJSPropertyInspectorModel::headerData(int section, Qt::Orientation or
{ {
if (orient == Qt::Horizontal && role == Qt::DisplayRole) { if (orient == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) { switch (section) {
case PROPERTY_NAME_COLUMN: return tr("Name"); case PROPERTY_NAME_COLUMN: return tr("Name");
case PROPERTY_VALUE_COLUMN: return tr("Value"); case PROPERTY_VALUE_COLUMN: return tr("Value");
case PROPERTY_TYPE_COLUMN: return tr("Type"); case PROPERTY_TYPE_COLUMN: return tr("Type");
}; };
} }
return QStandardItemModel::headerData(section, orient, role); 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, 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); QStandardItem *nameColumn = new QStandardItem(name);
nameColumn->setToolTip(name); nameColumn->setToolTip(name);