Browse Source

renamed contractDefinition to contractInterface

cl-refactor
arkpar 10 years ago
parent
commit
2183878e6e
  1. 8
      mix/CodeModel.cpp
  2. 8
      mix/CodeModel.h
  3. 4
      mix/qml/WebPreview.qml

8
mix/CodeModel.cpp

@ -61,7 +61,7 @@ CompilationResult::CompilationResult(const dev::solidity::CompilerStack& _compil
m_bytes = _compiler.getBytecode(); m_bytes = _compiler.getBytecode();
m_assemblyCode = QString::fromStdString(dev::eth::disassemble(m_bytes)); m_assemblyCode = QString::fromStdString(dev::eth::disassemble(m_bytes));
dev::solidity::InterfaceHandler interfaceHandler; dev::solidity::InterfaceHandler interfaceHandler;
m_contractDefinition = QString::fromStdString(*interfaceHandler.getABIInterface(contractDefinition)); m_contractInterface = QString::fromStdString(*interfaceHandler.getABIInterface(contractDefinition));
} }
else else
m_contract.reset(new QContractDefinition()); m_contract.reset(new QContractDefinition());
@ -75,7 +75,7 @@ CompilationResult::CompilationResult(CompilationResult const& _prev, QString con
m_compilerMessage(_compilerMessage), m_compilerMessage(_compilerMessage),
m_bytes(_prev.m_bytes), m_bytes(_prev.m_bytes),
m_assemblyCode(_prev.m_assemblyCode), m_assemblyCode(_prev.m_assemblyCode),
m_contractDefinition(_prev.m_contractDefinition), m_contractInterface(_prev.m_contractInterface),
m_codeHighlighter(_prev.m_codeHighlighter) m_codeHighlighter(_prev.m_codeHighlighter)
{} {}
@ -164,7 +164,7 @@ void CodeModel::runCompilationJob(int _jobId, QString const& _code)
void CodeModel::onCompilationComplete(CompilationResult* _newResult) void CodeModel::onCompilationComplete(CompilationResult* _newResult)
{ {
m_compiling = false; m_compiling = false;
bool contractChanged = m_result->contractDefinition() != _newResult->contractDefinition(); bool contractChanged = m_result->contractInterface() != _newResult->contractInterface();
m_result.reset(_newResult); m_result.reset(_newResult);
emit compilationComplete(); emit compilationComplete();
emit stateChanged(); emit stateChanged();
@ -172,7 +172,7 @@ void CodeModel::onCompilationComplete(CompilationResult* _newResult)
{ {
emit codeChanged(); emit codeChanged();
if (contractChanged) if (contractChanged)
emit contractDefinitionChanged(); emit contractInterfaceChanged();
} }
} }

8
mix/CodeModel.h

@ -67,7 +67,7 @@ class CompilationResult: public QObject
Q_PROPERTY(QContractDefinition* contract READ contract) Q_PROPERTY(QContractDefinition* contract READ contract)
Q_PROPERTY(QString compilerMessage READ compilerMessage CONSTANT) Q_PROPERTY(QString compilerMessage READ compilerMessage CONSTANT)
Q_PROPERTY(bool successful READ successful CONSTANT) Q_PROPERTY(bool successful READ successful CONSTANT)
Q_PROPERTY(QString contractDefinition READ contractDefinition CONSTANT) Q_PROPERTY(QString contractInterface READ contractInterface CONSTANT)
public: public:
/// Empty compilation result constructor /// Empty compilation result constructor
@ -90,7 +90,7 @@ public:
/// @returns contract bytecode in human-readable form /// @returns contract bytecode in human-readable form
QString assemblyCode() const { return m_assemblyCode; } QString assemblyCode() const { return m_assemblyCode; }
/// @returns contract definition in JSON format /// @returns contract definition in JSON format
QString contractDefinition() const { return m_contractDefinition; } QString contractInterface() const { return m_contractInterface; }
/// Get code highlighter /// Get code highlighter
std::shared_ptr<CodeHighlighter> codeHighlighter() { return m_codeHighlighter; } std::shared_ptr<CodeHighlighter> codeHighlighter() { return m_codeHighlighter; }
@ -101,7 +101,7 @@ private:
QString m_compilerMessage; ///< @todo: use some structure here QString m_compilerMessage; ///< @todo: use some structure here
dev::bytes m_bytes; dev::bytes m_bytes;
QString m_assemblyCode; QString m_assemblyCode;
QString m_contractDefinition; QString m_contractInterface;
std::shared_ptr<CodeHighlighter> m_codeHighlighter; std::shared_ptr<CodeHighlighter> m_codeHighlighter;
friend class CodeModel; friend class CodeModel;
@ -142,7 +142,7 @@ signals:
/// Emitted if there are any changes in the code model /// Emitted if there are any changes in the code model
void codeChanged(); void codeChanged();
/// Emitted if there are any changes in the contract interface /// Emitted if there are any changes in the contract interface
void contractDefinitionChanged(); void contractInterfaceChanged();
/// Emitted on compilation complete. Internal /// Emitted on compilation complete. Internal
void compilationCompleteInternal(CompilationResult* _newResult); void compilationCompleteInternal(CompilationResult* _newResult);

4
mix/qml/WebPreview.qml

@ -27,7 +27,7 @@ Item {
} }
function updateContract() { function updateContract() {
webView.runJavaScript("updateContract(\"" + clientModel.contractAddress + "\", " + codeModel.code.contractDefinition + ")"); webView.runJavaScript("updateContract(\"" + clientModel.contractAddress + "\", " + codeModel.code.contractInterface + ")");
} }
function reloadOnSave() { function reloadOnSave() {
@ -65,7 +65,7 @@ Item {
Connections { Connections {
target: codeModel target: codeModel
onContractDefinitionChanged: reload(); onContractInterfceChanged: reload();
} }
Connections { Connections {

Loading…
Cancel
Save