diff --git a/mix/AppContext.cpp b/mix/AppContext.cpp index 8eae2b230..ff2d10d01 100644 --- a/mix/AppContext.cpp +++ b/mix/AppContext.cpp @@ -60,7 +60,7 @@ void AppContext::loadProject() if (!path.isEmpty()) { QFile file(path); - if(file.open(QIODevice::ReadOnly | QIODevice::Text)) + if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream stream(&file); QString json = stream.readAll(); @@ -95,7 +95,7 @@ void AppContext::saveProject(QString const& _json) { dirPath.mkpath(dirPath.path()); QFile file(path); - if(file.open(QIODevice::WriteOnly | QIODevice::Text)) + if (file.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream(&file); stream << _json; diff --git a/mix/AppContext.h b/mix/AppContext.h index a7fa8a017..7435c7777 100644 --- a/mix/AppContext.h +++ b/mix/AppContext.h @@ -51,7 +51,7 @@ class CodeModel; * @brief Provides access to application scope variable. */ -class AppContext : public QObject +class AppContext: public QObject { Q_OBJECT diff --git a/mix/AssemblyDebuggerControl.cpp b/mix/AssemblyDebuggerControl.cpp index c230d9b6f..136353dc6 100644 --- a/mix/AssemblyDebuggerControl.cpp +++ b/mix/AssemblyDebuggerControl.cpp @@ -92,7 +92,7 @@ void AssemblyDebuggerControl::debugState(QVariantMap _state) std::vector transactionSequence; - for (auto const& t : transactions) + for (auto const& t: transactions) { QVariantMap transaction = t.toMap(); @@ -132,14 +132,14 @@ void AssemblyDebuggerControl::executeSequence(std::vector c QFunctionDefinition* f; ContractCallDataEncoder c; //encode data for all transactions - for (auto const& t : _sequence) + for (auto const& t: _sequence) { f = nullptr; - for (int k = 0; k < contractDef->functionsList().size(); k++) + for (int tf = 0; tf < contractDef->functionsList().size(); tf++) { - if (contractDef->functionsList().at(k)->name() == t.functionId) + if (contractDef->functionsList().at(tf)->name() == t.functionId) { - f = contractDef->functionsList().at(k); + f = contractDef->functionsList().at(tf); break; } } @@ -147,9 +147,9 @@ void AssemblyDebuggerControl::executeSequence(std::vector c throw std::runtime_error("function " + t.functionId.toStdString() + " not found"); c.encode(f->index()); - for (int k = 0; k < f->parametersList().size(); k++) + for (int p = 0; p < f->parametersList().size(); p++) { - QVariableDeclaration* var = (QVariableDeclaration*)f->parametersList().at(k); + QVariableDeclaration* var = (QVariableDeclaration*)f->parametersList().at(p); u256 value = 0; auto v = t.parameterValues.find(var->name()); if (v != t.parameterValues.cend()) @@ -171,7 +171,7 @@ void AssemblyDebuggerControl::executeSequence(std::vector c //we need to wrap states in a QObject before sending to QML. QList wStates; - for(int i = 0; i < debuggingContent.machineStates.size(); i++) + for (int i = 0; i < debuggingContent.machineStates.size(); i++) { QPointer s(new DebuggingStateWrapper(debuggingContent.executionCode, debuggingContent.executionData.toBytes())); s->setState(debuggingContent.machineStates.at(i)); @@ -182,7 +182,7 @@ void AssemblyDebuggerControl::executeSequence(std::vector c emit dataAvailable(debuggingContent.returnParameters, wStates, code); emit runComplete(); } - catch(boost::exception const& e) + catch(boost::exception const&) { emit runFailed(QString::fromStdString(boost::current_exception_diagnostic_information())); } diff --git a/mix/CodeHighlighter.cpp b/mix/CodeHighlighter.cpp index 7cc07c9a5..5c126d8e2 100644 --- a/mix/CodeHighlighter.cpp +++ b/mix/CodeHighlighter.cpp @@ -36,7 +36,7 @@ using namespace dev::mix; CodeHighlighterSettings::CodeHighlighterSettings() { backgroundColor = QColor(0x00, 0x2b, 0x36); - foregroundColor = QColor (0xee, 0xe8, 0xd5); + foregroundColor = QColor(0xee, 0xe8, 0xd5); formats[Keyword].setForeground(QColor(0x93, 0xa1, 0xa1)); formats[Comment].setForeground(QColor(0x85, 0x99, 0x00)); formats[StringLiteral].setForeground(QColor(0xdc, 0x32, 0x2f)); @@ -49,7 +49,7 @@ CodeHighlighterSettings::CodeHighlighterSettings() namespace { using namespace dev::solidity; - class HighlightVisitor : public ASTConstVisitor + class HighlightVisitor: public ASTConstVisitor { public: HighlightVisitor(CodeHighlighter::Formats* _formats) { m_formats = _formats; } diff --git a/mix/CodeModel.cpp b/mix/CodeModel.cpp index 8d2c24725..7d8b0442a 100644 --- a/mix/CodeModel.cpp +++ b/mix/CodeModel.cpp @@ -41,14 +41,17 @@ void BackgroundWorker::queueCodeChange(int _jobId, QString const& _content) } CompilationResult::CompilationResult(): - QObject(nullptr), m_successfull(false), + QObject(nullptr), + m_successful(false), m_codeHash(qHash(QString())), m_contract(new QContractDefinition()), m_codeHighlighter(new CodeHighlighter()) {} CompilationResult::CompilationResult(const solidity::CompilerStack& _compiler): - QObject(nullptr), m_successfull(true), m_codeHash(qHash(QString())) + QObject(nullptr), + m_successful(true), + m_codeHash(qHash(QString())) { if (!_compiler.getContractNames().empty()) { @@ -61,7 +64,9 @@ CompilationResult::CompilationResult(const solidity::CompilerStack& _compiler): } CompilationResult::CompilationResult(CompilationResult const& _prev, QString const& _compilerMessage): - QObject(nullptr), m_successfull(false), m_codeHash(qHash(QString())), + QObject(nullptr), + m_successful(false), + m_codeHash(qHash(QString())), m_contract(_prev.m_contract), m_compilerMessage(_compilerMessage), m_bytes(_prev.m_bytes), @@ -69,8 +74,13 @@ CompilationResult::CompilationResult(CompilationResult const& _prev, QString con m_codeHighlighter(_prev.m_codeHighlighter) {} -CodeModel::CodeModel(QObject* _parent) : QObject(_parent), - m_compiling(false), m_result(new CompilationResult()), m_codeHighlighterSettings(new CodeHighlighterSettings()), m_backgroundWorker(this), m_backgroundJobId(0) +CodeModel::CodeModel(QObject* _parent): + QObject(_parent), + m_compiling(false), + m_result(new CompilationResult()), + m_codeHighlighterSettings(new CodeHighlighterSettings()), + m_backgroundWorker(this), + m_backgroundJobId(0) { m_backgroundWorker.moveToThread(&m_backgroundThread); connect(this, &CodeModel::scheduleCompilationJob, &m_backgroundWorker, &BackgroundWorker::queueCodeChange, Qt::QueuedConnection); @@ -97,7 +107,7 @@ void CodeModel::stop() m_backgroundThread.wait(); } -void CodeModel::registerCodeChange(const QString &_code) +void CodeModel::registerCodeChange(QString const& _code) { // launch the background thread uint hash = qHash(_code); diff --git a/mix/CodeModel.h b/mix/CodeModel.h index 69c840aa5..c66703b22 100644 --- a/mix/CodeModel.h +++ b/mix/CodeModel.h @@ -61,7 +61,7 @@ private: }; ///Compilation result model. Contains all the compiled contract data required by UI -class CompilationResult : public QObject +class CompilationResult: public QObject { Q_OBJECT Q_PROPERTY(QContractDefinition* contract READ contract) @@ -79,7 +79,7 @@ public: /// @returns contract definition std::shared_ptr sharedContract() { return m_contract; } /// Indicates if the compilation was successfull - bool successfull() const { return m_successfull; } + bool successfull() const { return m_successful; } /// @returns compiler error message in case of unsuccessfull compilation QString compilerMessage() const { return m_compilerMessage; } /// @returns contract bytecode @@ -90,7 +90,7 @@ public: std::shared_ptr codeHighlighter() { return m_codeHighlighter; } private: - bool m_successfull; + bool m_successful; uint m_codeHash; std::shared_ptr m_contract; QString m_compilerMessage; ///< @todo: use some structure here @@ -102,7 +102,7 @@ private: }; /// Background code compiler -class CodeModel : public QObject +class CodeModel: public QObject { Q_OBJECT @@ -139,7 +139,7 @@ signals: void compilationCompleteInternal(CompilationResult* _newResult); private slots: - void onCompilationComplete(CompilationResult*_newResult); + void onCompilationComplete(CompilationResult* _newResult); public slots: /// Update code model on source code change diff --git a/mix/MixApplication.h b/mix/MixApplication.h index e1cb1e5cf..86c1126fc 100644 --- a/mix/MixApplication.h +++ b/mix/MixApplication.h @@ -43,7 +43,8 @@ public: MixApplication(int _argc, char* _argv[]); virtual ~MixApplication(); AppContext* context() { return m_appContext.get(); } - QQmlApplicationEngine* engine( ) { return m_engine.get(); } + QQmlApplicationEngine* engine() { return m_engine.get(); } + private: std::unique_ptr m_engine; std::unique_ptr m_appContext; diff --git a/mix/main.cpp b/mix/main.cpp index e10903c80..90099555f 100644 --- a/mix/main.cpp +++ b/mix/main.cpp @@ -23,7 +23,7 @@ #include "MixApplication.h" using namespace dev::mix; -int main(int _argc, char *_argv[]) +int main(int _argc, char* _argv[]) { MixApplication app(_argc, _argv); return app.exec();