forked from qt-creator/qt-creator
Debugger: Prompt for reload if set/reset binding fails.
QtCreator takes into account the result of message from qtdeclarative for setting, resetting and updating the method body. Task-number: QTCREATORBUG-3264 Change-Id: I15d1a33990175e86bb3f2fee08f75dd5b7b1b628 Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
This commit is contained in:
committed by
Christiaan Janssen
parent
d3f3ab0115
commit
80180ba714
@@ -230,7 +230,10 @@ void BaseEngineDebugClient::messageReceived(const QByteArray &data)
|
||||
emit result(queryId, exprResult, type);
|
||||
} else if (type == "WATCH_PROPERTY_R" ||
|
||||
type == "WATCH_OBJECT_R" ||
|
||||
type == "WATCH_EXPR_OBJECT_R") {
|
||||
type == "WATCH_EXPR_OBJECT_R" ||
|
||||
type == "SET_BINDING_R" ||
|
||||
type == "RESET_BINDING_R" ||
|
||||
type == "SET_METHOD_BODY_R") {
|
||||
bool valid;
|
||||
ds >> valid;
|
||||
emit result(queryId, valid, type);
|
||||
|
||||
@@ -423,6 +423,14 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
|
||||
if (type == _("FETCH_OBJECT_R")) {
|
||||
log(LogReceive, _("FETCH_OBJECT_R %1").arg(
|
||||
qvariant_cast<ObjectReference>(value).idString()));
|
||||
} else if (type == _("SET_BINDING_R")
|
||||
|| type == _("RESET_BINDING_R")
|
||||
|| type == _("SET_METHOD_BODY_R")) {
|
||||
QString msg = QLatin1String(type) + tr(" success : ");
|
||||
msg += value.toBool() ? "1" : "0";
|
||||
if (!value.toBool())
|
||||
emit automaticUpdateFailed();
|
||||
log(LogReceive, msg);
|
||||
} else {
|
||||
log(LogReceive, QLatin1String(type));
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ signals:
|
||||
void expressionResult(quint32 queryId, const QVariant &value);
|
||||
void propertyChanged(int debugId, const QByteArray &propertyName,
|
||||
const QVariant &propertyValue);
|
||||
void automaticUpdateFailed();
|
||||
|
||||
private slots:
|
||||
void updateStatus();
|
||||
|
||||
@@ -376,6 +376,8 @@ QmlLiveTextPreview::QmlLiveTextPreview(const QmlJS::Document::Ptr &doc,
|
||||
SIGNAL(fetchObjectsForLocation(QString,int,int)),
|
||||
m_inspectorAdapter->agent(),
|
||||
SLOT(fetchContextObjectsForLocation(QString,int,int)));
|
||||
connect(m_inspectorAdapter->agent(), SIGNAL(automaticUpdateFailed()),
|
||||
SLOT(onAutomaticUpdateFailed()));
|
||||
}
|
||||
|
||||
void QmlLiveTextPreview::associateEditor(Core::IEditor *editor)
|
||||
@@ -598,7 +600,6 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
||||
|
||||
if (doc && m_previousDoc && doc->fileName() == m_previousDoc->fileName()) {
|
||||
if (doc->fileName().endsWith(".js")) {
|
||||
m_changesUnsynchronizable = true;
|
||||
showSyncWarning(JSChangeWarning, QString(), 0, 0);
|
||||
m_previousDoc = doc;
|
||||
return;
|
||||
@@ -612,7 +613,6 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
||||
|
||||
|
||||
if (delta.unsyncronizableChanges != NoUnsyncronizableChanges) {
|
||||
m_changesUnsynchronizable = true;
|
||||
showSyncWarning(delta.unsyncronizableChanges,
|
||||
delta.unsyncronizableElementName,
|
||||
delta.unsyncronizableChangeLine,
|
||||
@@ -638,6 +638,11 @@ void QmlLiveTextPreview::editorContentsChanged()
|
||||
m_contentsChanged = true;
|
||||
}
|
||||
|
||||
void QmlLiveTextPreview::onAutomaticUpdateFailed()
|
||||
{
|
||||
showSyncWarning(AutomaticUpdateFailed, QString(), -1, -1);
|
||||
}
|
||||
|
||||
QList<int> QmlLiveTextPreview::objectReferencesForOffset(quint32 offset)
|
||||
{
|
||||
QList<int> result;
|
||||
@@ -688,11 +693,16 @@ void QmlLiveTextPreview::showSyncWarning(
|
||||
errorMessage = tr("The changes in JavaScript cannot be applied "
|
||||
"without reloading the QML application. ");
|
||||
break;
|
||||
case AutomaticUpdateFailed:
|
||||
errorMessage = tr("The changes made cannot be applied without "
|
||||
"reloading the QML application. ");
|
||||
break;
|
||||
case QmlLiveTextPreview::NoUnsyncronizableChanges:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
m_changesUnsynchronizable = true;
|
||||
errorMessage.append(tr("You can continue debugging, but behavior can be unexpected."));
|
||||
|
||||
// Clear infobars if present before showing the same. Otherwise multiple infobars
|
||||
|
||||
@@ -84,13 +84,15 @@ private slots:
|
||||
const QString &wordAtCursor);
|
||||
void documentChanged(QmlJS::Document::Ptr doc);
|
||||
void editorContentsChanged();
|
||||
void onAutomaticUpdateFailed();
|
||||
|
||||
private:
|
||||
enum UnsyncronizableChangeType {
|
||||
NoUnsyncronizableChanges,
|
||||
AttributeChangeWarning,
|
||||
ElementChangeWarning,
|
||||
JSChangeWarning
|
||||
JSChangeWarning,
|
||||
AutomaticUpdateFailed
|
||||
};
|
||||
|
||||
bool changeSelectedElements(const QList<int> offsets, const QString &wordAtCursor);
|
||||
|
||||
Reference in New Issue
Block a user