Browse Source

- rename init() => update() in AssemblyDebuggerControl

- rename ConstantCompilationControl.cpp => StatusPane.cpp
cl-refactor
yann300 10 years ago
parent
commit
49467ed8e2
  1. 2
      mix/AssemblyDebuggerControl.cpp
  2. 5
      mix/CodeEditorExtensionManager.cpp
  3. 2
      mix/CodeEditorExtensionManager.h
  4. 2
      mix/DebuggingStateWrapper.cpp
  5. 22
      mix/StatusPane.cpp
  6. 6
      mix/StatusPane.h
  7. 2
      mix/qml.qrc
  8. 6
      mix/qml/Debugger.qml
  9. 6
      mix/qml/StatusPane.qml

2
mix/AssemblyDebuggerControl.cpp

@ -208,7 +208,7 @@ void AssemblyDebuggerControl::updateDebugPanel()
{ {
QVariant returnValue; QVariant returnValue;
QObject* debugPanel = m_view->findChild<QObject*>("debugPanel", Qt::FindChildrenRecursively); QObject* debugPanel = m_view->findChild<QObject*>("debugPanel", Qt::FindChildrenRecursively);
QMetaObject::invokeMethod(debugPanel, "init", Q_RETURN_ARG(QVariant, returnValue)); QMetaObject::invokeMethod(debugPanel, "update", Q_RETURN_ARG(QVariant, returnValue));
} }
void AssemblyDebuggerControl::showDebugError(QString const& _error) void AssemblyDebuggerControl::showDebugError(QString const& _error)

5
mix/CodeEditorExtensionManager.cpp

@ -25,7 +25,7 @@
#include <QQmlEngine> #include <QQmlEngine>
#include <QQmlComponent> #include <QQmlComponent>
#include <QQuickTextDocument> #include <QQuickTextDocument>
#include "ConstantCompilationControl.h" #include "StatusPane.h"
#include "AssemblyDebuggerControl.h" #include "AssemblyDebuggerControl.h"
#include "StateListView.h" #include "StateListView.h"
#include "AppContext.h" #include "AppContext.h"
@ -64,11 +64,10 @@ void CodeEditorExtensionManager::loadEditor(QQuickItem* _editor)
void CodeEditorExtensionManager::initExtensions() void CodeEditorExtensionManager::initExtensions()
{ {
std::shared_ptr<ConstantCompilationControl> output = std::make_shared<ConstantCompilationControl>(m_appContext); std::shared_ptr<StatusPane> output = std::make_shared<StatusPane>(m_appContext);
std::shared_ptr<AssemblyDebuggerControl> debug = std::make_shared<AssemblyDebuggerControl>(m_appContext); std::shared_ptr<AssemblyDebuggerControl> debug = std::make_shared<AssemblyDebuggerControl>(m_appContext);
std::shared_ptr<StateListView> stateList = std::make_shared<StateListView>(m_appContext); std::shared_ptr<StateListView> stateList = std::make_shared<StateListView>(m_appContext);
QObject::connect(m_doc, &QTextDocument::contentsChange, this, &CodeEditorExtensionManager::onCodeChange); QObject::connect(m_doc, &QTextDocument::contentsChange, this, &CodeEditorExtensionManager::onCodeChange);
//QObject::connect(debug.get(), &AssemblyDebuggerControl::runFailed, output.get(), &ConstantCompilationControl::displayError);
QObject::connect(m_appContext->codeModel(), &CodeModel::compilationComplete, this, &CodeEditorExtensionManager::applyCodeHighlight); QObject::connect(m_appContext->codeModel(), &CodeModel::compilationComplete, this, &CodeEditorExtensionManager::applyCodeHighlight);
initExtension(output); initExtension(output);

2
mix/CodeEditorExtensionManager.h

@ -26,7 +26,7 @@
#include <QQuickItem> #include <QQuickItem>
#include <QTextDocument> #include <QTextDocument>
#include <QVector> #include <QVector>
#include "ConstantCompilationControl.h" #include "StatusPane.h"
namespace dev namespace dev
{ {

2
mix/DebuggingStateWrapper.cpp

@ -105,7 +105,7 @@ QStringList DebuggingStateWrapper::debugStorage()
s << "@" << prettyU256(i.first) << " " << prettyU256(i.second); s << "@" << prettyU256(i.first) << " " << prettyU256(i.second);
storage.append(QString::fromStdString(s.str())); storage.append(QString::fromStdString(s.str()));
} }
return fillList(storage, "@- -"); return fillList(storage, "@ -");
} }
QStringList DebuggingStateWrapper::debugMemory() QStringList DebuggingStateWrapper::debugMemory()

22
mix/ConstantCompilationControl.cpp → mix/StatusPane.cpp

@ -27,40 +27,40 @@
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QtCore/QtCore> #include <QtCore/QtCore>
#include <QDebug> #include <QDebug>
#include "ConstantCompilationControl.h" #include "StatusPane.h"
#include "QContractDefinition.h" #include "QContractDefinition.h"
#include "AppContext.h" #include "AppContext.h"
#include "CodeModel.h" #include "CodeModel.h"
using namespace dev::mix; using namespace dev::mix;
ConstantCompilationControl::ConstantCompilationControl(AppContext* _context): Extension(_context, ExtensionDisplayBehavior::HeaderView) StatusPane::StatusPane(AppContext* _context): Extension(_context, ExtensionDisplayBehavior::HeaderView)
{ {
connect(_context->codeModel(), &CodeModel::compilationComplete, this, &ConstantCompilationControl::update); connect(_context->codeModel(), &CodeModel::compilationComplete, this, &StatusPane::update);
_context->appEngine()->rootContext()->setContextProperty("constantCompilation", this); _context->appEngine()->rootContext()->setContextProperty("statusPane", this);
} }
QString ConstantCompilationControl::contentUrl() const QString StatusPane::contentUrl() const
{ {
return QStringLiteral("qrc:/qml/CompilationStatus.qml"); return QStringLiteral("qrc:/qml/StatusPane.qml");
} }
QString ConstantCompilationControl::title() const QString StatusPane::title() const
{ {
return QApplication::tr("compiler"); return QApplication::tr("compiler");
} }
void ConstantCompilationControl::start() const void StatusPane::start() const
{ {
} }
CompilationResult* ConstantCompilationControl::result() const CompilationResult* StatusPane::result() const
{ {
return m_ctx->codeModel()->code(); return m_ctx->codeModel()->code();
} }
void ConstantCompilationControl::update() void StatusPane::update()
{ {
QObject* ctrl = m_view->findChild<QObject*>("constantCompilationStatus", Qt::FindChildrenRecursively); QObject* ctrl = m_view->findChild<QObject*>("statusPane", Qt::FindChildrenRecursively);
QMetaObject::invokeMethod(ctrl, "update"); QMetaObject::invokeMethod(ctrl, "update");
} }

6
mix/ConstantCompilationControl.h → mix/StatusPane.h

@ -30,14 +30,14 @@ namespace mix
/** /**
* @brief Extension which display assembly code of the contract being edited. * @brief Extension which display assembly code of the contract being edited.
*/ */
class ConstantCompilationControl: public Extension class StatusPane: public Extension
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(CompilationResult* result READ result CONSTANT) Q_PROPERTY(CompilationResult* result READ result CONSTANT)
public: public:
ConstantCompilationControl(AppContext* _appContext); StatusPane(AppContext* _appContext);
~ConstantCompilationControl() {} ~StatusPane() {}
void start() const override; void start() const override;
QString title() const override; QString title() const override;
QString contentUrl() const override; QString contentUrl() const override;

2
mix/qml.qrc

@ -12,7 +12,6 @@
<file>qml/AlertMessageDialog.qml</file> <file>qml/AlertMessageDialog.qml</file>
<file>qml/StateDialog.qml</file> <file>qml/StateDialog.qml</file>
<file>qml/StateList.qml</file> <file>qml/StateList.qml</file>
<file>qml/CompilationStatus.qml</file>
<file>qml/js/main.js</file> <file>qml/js/main.js</file>
<file>qml/img/jumpintoback.png</file> <file>qml/img/jumpintoback.png</file>
<file>qml/img/jumpintoforward.png</file> <file>qml/img/jumpintoforward.png</file>
@ -34,5 +33,6 @@
<file>qml/img/bugiconinactive.png</file> <file>qml/img/bugiconinactive.png</file>
<file>qml/DebugInfoList.qml</file> <file>qml/DebugInfoList.qml</file>
<file>qml/ItemDelegateDataDump.qml</file> <file>qml/ItemDelegateDataDump.qml</file>
<file>qml/StatusPane.qml</file>
</qresource> </qresource>
</RCC> </RCC>

6
mix/qml/Debugger.qml

@ -20,9 +20,9 @@ Rectangle {
Debugger.moveSelection(-1); Debugger.moveSelection(-1);
} }
function init() function update()
{ {
if (constantCompilation.result.successfull) if (statusPane.result.successfull)
{ {
Debugger.init(); Debugger.init();
debugScrollArea.visible = true; debugScrollArea.visible = true;
@ -35,7 +35,7 @@ Rectangle {
compilationErrorArea.visible = true; compilationErrorArea.visible = true;
machineStates.visible = false; machineStates.visible = false;
console.log(constantCompilation.result.compilerMessage); console.log(constantCompilation.result.compilerMessage);
var errorInfo = ErrorLocationFormater.extractErrorInfo(constantCompilation.result.compilerMessage, false); var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, false);
errorLocation.text = errorInfo.errorLocation; errorLocation.text = errorInfo.errorLocation;
errorDetail.text = errorInfo.errorDetail; errorDetail.text = errorInfo.errorDetail;
errorLine.text = errorInfo.errorLine; errorLine.text = errorInfo.errorLine;

6
mix/qml/CompilationStatus.qml → mix/qml/StatusPane.qml

@ -5,10 +5,10 @@ import "js/ErrorLocationFormater.js" as ErrorLocationFormater
Rectangle { Rectangle {
id: constantCompilationStatus id: constantCompilationStatus
objectName: "constantCompilationStatus" objectName: "statusPane"
function update() function update()
{ {
if (constantCompilation.result.successfull) if (statusPane.result.successfull)
{ {
image.state = ""; image.state = "";
status.state = ""; status.state = "";
@ -19,7 +19,7 @@ Rectangle {
{ {
image.state = "error"; image.state = "error";
status.state = "error"; status.state = "error";
var errorInfo = ErrorLocationFormater.extractErrorInfo(constantCompilation.result.compilerMessage, true); var errorInfo = ErrorLocationFormater.extractErrorInfo(statusPane.result.compilerMessage, true);
status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail; status.text = errorInfo.errorLocation + " " + errorInfo.errorDetail;
logslink.visible = true; logslink.visible = true;
} }
Loading…
Cancel
Save