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);
|
emit result(queryId, exprResult, type);
|
||||||
} else if (type == "WATCH_PROPERTY_R" ||
|
} else if (type == "WATCH_PROPERTY_R" ||
|
||||||
type == "WATCH_OBJECT_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;
|
bool valid;
|
||||||
ds >> valid;
|
ds >> valid;
|
||||||
emit result(queryId, valid, type);
|
emit result(queryId, valid, type);
|
||||||
|
|||||||
@@ -423,6 +423,14 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
|
|||||||
if (type == _("FETCH_OBJECT_R")) {
|
if (type == _("FETCH_OBJECT_R")) {
|
||||||
log(LogReceive, _("FETCH_OBJECT_R %1").arg(
|
log(LogReceive, _("FETCH_OBJECT_R %1").arg(
|
||||||
qvariant_cast<ObjectReference>(value).idString()));
|
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 {
|
} else {
|
||||||
log(LogReceive, QLatin1String(type));
|
log(LogReceive, QLatin1String(type));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ signals:
|
|||||||
void expressionResult(quint32 queryId, const QVariant &value);
|
void expressionResult(quint32 queryId, const QVariant &value);
|
||||||
void propertyChanged(int debugId, const QByteArray &propertyName,
|
void propertyChanged(int debugId, const QByteArray &propertyName,
|
||||||
const QVariant &propertyValue);
|
const QVariant &propertyValue);
|
||||||
|
void automaticUpdateFailed();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
|
|||||||
@@ -376,6 +376,8 @@ QmlLiveTextPreview::QmlLiveTextPreview(const QmlJS::Document::Ptr &doc,
|
|||||||
SIGNAL(fetchObjectsForLocation(QString,int,int)),
|
SIGNAL(fetchObjectsForLocation(QString,int,int)),
|
||||||
m_inspectorAdapter->agent(),
|
m_inspectorAdapter->agent(),
|
||||||
SLOT(fetchContextObjectsForLocation(QString,int,int)));
|
SLOT(fetchContextObjectsForLocation(QString,int,int)));
|
||||||
|
connect(m_inspectorAdapter->agent(), SIGNAL(automaticUpdateFailed()),
|
||||||
|
SLOT(onAutomaticUpdateFailed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlLiveTextPreview::associateEditor(Core::IEditor *editor)
|
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 && m_previousDoc && doc->fileName() == m_previousDoc->fileName()) {
|
||||||
if (doc->fileName().endsWith(".js")) {
|
if (doc->fileName().endsWith(".js")) {
|
||||||
m_changesUnsynchronizable = true;
|
|
||||||
showSyncWarning(JSChangeWarning, QString(), 0, 0);
|
showSyncWarning(JSChangeWarning, QString(), 0, 0);
|
||||||
m_previousDoc = doc;
|
m_previousDoc = doc;
|
||||||
return;
|
return;
|
||||||
@@ -612,7 +613,6 @@ void QmlLiveTextPreview::documentChanged(QmlJS::Document::Ptr doc)
|
|||||||
|
|
||||||
|
|
||||||
if (delta.unsyncronizableChanges != NoUnsyncronizableChanges) {
|
if (delta.unsyncronizableChanges != NoUnsyncronizableChanges) {
|
||||||
m_changesUnsynchronizable = true;
|
|
||||||
showSyncWarning(delta.unsyncronizableChanges,
|
showSyncWarning(delta.unsyncronizableChanges,
|
||||||
delta.unsyncronizableElementName,
|
delta.unsyncronizableElementName,
|
||||||
delta.unsyncronizableChangeLine,
|
delta.unsyncronizableChangeLine,
|
||||||
@@ -638,6 +638,11 @@ void QmlLiveTextPreview::editorContentsChanged()
|
|||||||
m_contentsChanged = true;
|
m_contentsChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlLiveTextPreview::onAutomaticUpdateFailed()
|
||||||
|
{
|
||||||
|
showSyncWarning(AutomaticUpdateFailed, QString(), -1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
QList<int> QmlLiveTextPreview::objectReferencesForOffset(quint32 offset)
|
QList<int> QmlLiveTextPreview::objectReferencesForOffset(quint32 offset)
|
||||||
{
|
{
|
||||||
QList<int> result;
|
QList<int> result;
|
||||||
@@ -688,11 +693,16 @@ void QmlLiveTextPreview::showSyncWarning(
|
|||||||
errorMessage = tr("The changes in JavaScript cannot be applied "
|
errorMessage = tr("The changes in JavaScript cannot be applied "
|
||||||
"without reloading the QML application. ");
|
"without reloading the QML application. ");
|
||||||
break;
|
break;
|
||||||
|
case AutomaticUpdateFailed:
|
||||||
|
errorMessage = tr("The changes made cannot be applied without "
|
||||||
|
"reloading the QML application. ");
|
||||||
|
break;
|
||||||
case QmlLiveTextPreview::NoUnsyncronizableChanges:
|
case QmlLiveTextPreview::NoUnsyncronizableChanges:
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_changesUnsynchronizable = true;
|
||||||
errorMessage.append(tr("You can continue debugging, but behavior can be unexpected."));
|
errorMessage.append(tr("You can continue debugging, but behavior can be unexpected."));
|
||||||
|
|
||||||
// Clear infobars if present before showing the same. Otherwise multiple infobars
|
// Clear infobars if present before showing the same. Otherwise multiple infobars
|
||||||
|
|||||||
@@ -84,13 +84,15 @@ private slots:
|
|||||||
const QString &wordAtCursor);
|
const QString &wordAtCursor);
|
||||||
void documentChanged(QmlJS::Document::Ptr doc);
|
void documentChanged(QmlJS::Document::Ptr doc);
|
||||||
void editorContentsChanged();
|
void editorContentsChanged();
|
||||||
|
void onAutomaticUpdateFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum UnsyncronizableChangeType {
|
enum UnsyncronizableChangeType {
|
||||||
NoUnsyncronizableChanges,
|
NoUnsyncronizableChanges,
|
||||||
AttributeChangeWarning,
|
AttributeChangeWarning,
|
||||||
ElementChangeWarning,
|
ElementChangeWarning,
|
||||||
JSChangeWarning
|
JSChangeWarning,
|
||||||
|
AutomaticUpdateFailed
|
||||||
};
|
};
|
||||||
|
|
||||||
bool changeSelectedElements(const QList<int> offsets, const QString &wordAtCursor);
|
bool changeSelectedElements(const QList<int> offsets, const QString &wordAtCursor);
|
||||||
|
|||||||
Reference in New Issue
Block a user