Browse Source

- bug fix : return parameters are not displayed if the dialog is

displayed two times (Debugger.init() was only called one time).
cl-refactor
yann300 10 years ago
parent
commit
1c855b3141
  1. 1
      mix/AppContext.cpp
  2. 2
      mix/AssemblyDebuggerCtrl.cpp
  3. 4
      mix/Extension.cpp
  4. 5
      mix/QVariableDefinition.h
  5. 5
      mix/qml/AlertMessageDialog.qml
  6. 2
      mix/qml/Debugger.qml
  7. 7
      mix/qml/ModalDialog.qml
  8. 2
      mix/qml/js/Debugger.js

1
mix/AppContext.cpp

@ -84,7 +84,6 @@ void AppContext::displayMessageDialog(QString _title, QString _message)
{
QObject* dialogWin = m_applicationEngine.get()->rootObjects().at(0)->findChild<QObject*>("alertMessageDialog", Qt::FindChildrenRecursively);
QObject* dialogWinComponent = m_applicationEngine.get()->rootObjects().at(0)->findChild<QObject*>("alertMessageDialogContent", Qt::FindChildrenRecursively);
QMetaObject::invokeMethod(dialogWin, "close");
dialogWinComponent->setProperty("source", QString("qrc:/qml/BasicMessage.qml"));
dialogWin->setProperty("title", _title);
dialogWin->setProperty("width", "250");

2
mix/AssemblyDebuggerCtrl.cpp

@ -155,7 +155,7 @@ void AssemblyDebuggerCtrl::updateGUI(bool _success, DebuggingStatusResult _reaso
m_appEngine->rootContext()->setContextProperty("debugStates", QVariant::fromValue(_wStates));
m_appEngine->rootContext()->setContextProperty("humanReadableExecutionCode", QVariant::fromValue(std::get<0>(_code)));
m_appEngine->rootContext()->setContextProperty("bytesCodeMapping", QVariant::fromValue(std::get<1>(_code)));
AppContext::getInstance()->appEngine()->rootContext()->setContextProperty("contractCallReturnParameters",
m_appEngine->rootContext()->setContextProperty("contractCallReturnParameters",
QVariant::fromValue(new QVariableDefinitionList(_returnParam)));
this->addContentOn(this);
}

4
mix/Extension.cpp

@ -65,10 +65,10 @@ void Extension::addContentOn(QObject* _view)
Q_UNUSED(_view);
if (m_displayBehavior == ExtensionDisplayBehavior::ModalDialog)
{
QQmlComponent* component = new QQmlComponent(AppContext::getInstance()->appEngine(), QUrl(contentUrl()), _view);
QObject* dialogWin = AppContext::getInstance()->appEngine()->rootObjects().at(0)->findChild<QObject*>("dialog", Qt::FindChildrenRecursively);
QObject* dialogWinComponent = AppContext::getInstance()->appEngine()->rootObjects().at(0)->findChild<QObject*>("modalDialogContent", Qt::FindChildrenRecursively);
QMetaObject::invokeMethod(dialogWin, "close");
dialogWinComponent->setProperty("source", contentUrl());
dialogWinComponent->setProperty("sourceComponent", QVariant::fromValue(component));
dialogWin->setProperty("title", title());
QMetaObject::invokeMethod(dialogWin, "open");
}

5
mix/QVariableDefinition.h

@ -49,7 +49,6 @@ private:
class QVariableDefinitionList: public QAbstractListModel
{
Q_OBJECT
//Q_PROPERTY(QList<QVariableDefinition*> def READ def)
public:
QVariableDefinitionList(QList<QVariableDefinition*> _def): m_def(_def) {}
@ -57,9 +56,7 @@ public:
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
QVariableDefinition* val(int idx);
QList<QVariableDefinition*> def() {
return m_def;
}
QList<QVariableDefinition*> def() { return m_def; }
private:
QList<QVariableDefinition*> m_def;

5
mix/qml/AlertMessageDialog.qml

@ -22,6 +22,9 @@ Window
}
function close()
{
visible = false
visible = false;
alertMessageDialogContent.source = "";
alertMessageDialogContent.sourceComponent = undefined;
alertMessageDialog.destroy();
}
}

2
mix/qml/Debugger.qml

@ -8,6 +8,7 @@ import "js/Debugger.js" as Debugger
Rectangle {
anchors.fill: parent;
color: "lightgrey"
Component.onCompleted: Debugger.init();
Rectangle {
color: "transparent"
id: headerInfo
@ -79,7 +80,6 @@ Rectangle {
width: 200
anchors.horizontalCenter: parent.horizontalCenter
id: statesList
Component.onCompleted: Debugger.init();
model: humanReadableExecutionCode
delegate: renderDelegate
highlight: highlightBar

7
mix/qml/ModalDialog.qml

@ -18,10 +18,13 @@ Window
}
function open()
{
visible = true
visible = true;
}
function close()
{
visible = false
visible = false;
modalDialogContent.source = "";
modalDialogContent.sourceComponent = undefined;
modalDialog.destroy();
}
}

2
mix/qml/js/Debugger.js

@ -66,8 +66,6 @@ function endOfDebug()
function displayReturnValue()
{
console.log("JSON.stringify(contractCallRe");
console.log(JSON.stringify(contractCallReturnParameters));
headerReturnList.model = contractCallReturnParameters;
headerReturnList.update();
}

Loading…
Cancel
Save