diff --git a/CMakeLists.txt b/CMakeLists.txt index d8c517fef..e3a7d9b83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,6 +158,7 @@ if (NOT LANGUAGES) add_subdirectory(libqethereum) add_subdirectory(alethzero) add_subdirectory(third) + add_subdirectory(mix) if(QTQML) #add_subdirectory(iethxi) #add_subdirectory(walleth) // resurect once we want to submit ourselves to QML. @@ -171,3 +172,4 @@ add_test(NAME alltests WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testet #unset(TARGET_PLATFORM CACHE) + diff --git a/mix/ApplicationContext.cpp b/mix/ApplicationContext.cpp deleted file mode 100644 index dcbb6d958..000000000 --- a/mix/ApplicationContext.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "ApplicationContext.h" -#include - -ApplicationContext* ApplicationContext::m_instance = nullptr; - -ApplicationContext::ApplicationContext(QQmlApplicationEngine* _engine) -{ - m_applicationEngine = _engine; -} - -ApplicationContext::~ApplicationContext() -{ - delete m_applicationEngine; -} - -ApplicationContext* ApplicationContext::GetInstance() -{ - return m_instance; -} - -void ApplicationContext::SetApplicationContext(QQmlApplicationEngine* engine) -{ - m_instance = new ApplicationContext(engine); -} - -QQmlApplicationEngine* ApplicationContext::appEngine(){ - return m_applicationEngine; -} - -void ApplicationContext::QuitApplication() -{ - delete m_instance; -} diff --git a/mix/ApplicationCtx.cpp b/mix/ApplicationCtx.cpp new file mode 100644 index 000000000..1c8ed9820 --- /dev/null +++ b/mix/ApplicationCtx.cpp @@ -0,0 +1,55 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file main.cpp + * @author Gav Wood + * @date 2014 + * Ethereum client. + */ + +#include "ApplicationCtx.h" +#include + +ApplicationCtx* ApplicationCtx::m_instance = nullptr; + +ApplicationCtx::ApplicationCtx(QQmlApplicationEngine* _engine) +{ + m_applicationEngine = _engine; +} + +ApplicationCtx::~ApplicationCtx() +{ + delete m_applicationEngine; +} + +ApplicationCtx* ApplicationCtx::GetInstance() +{ + return m_instance; +} + +void ApplicationCtx::SetApplicationContext(QQmlApplicationEngine* engine) +{ + m_instance = new ApplicationCtx(engine); +} + +QQmlApplicationEngine* ApplicationCtx::appEngine(){ + return m_applicationEngine; +} + +void ApplicationCtx::QuitApplication() +{ + delete m_instance; +} diff --git a/mix/ApplicationContext.h b/mix/ApplicationCtx.h similarity index 57% rename from mix/ApplicationContext.h rename to mix/ApplicationCtx.h index 154a4120e..f54eb7f09 100644 --- a/mix/ApplicationContext.h +++ b/mix/ApplicationCtx.h @@ -3,21 +3,21 @@ #include -class ApplicationContext : public QObject +class ApplicationCtx : public QObject { Q_OBJECT public: - ApplicationContext(QQmlApplicationEngine*); - ~ApplicationContext(); + ApplicationCtx(QQmlApplicationEngine*); + ~ApplicationCtx(); QQmlApplicationEngine* appEngine(); - static ApplicationContext* GetInstance(); + static ApplicationCtx* GetInstance(); static void SetApplicationContext(QQmlApplicationEngine*); private: - static ApplicationContext* m_instance; + static ApplicationCtx* m_instance; QQmlApplicationEngine* m_applicationEngine; public slots: void QuitApplication(); }; -#endif // APPLICATIONCONTEXT_H +#endif // APPLICATIONCTX_H diff --git a/mix/CodeEditorExtensionMan.cpp b/mix/CodeEditorExtensionMan.cpp index 1c845dbbf..d9691fb42 100644 --- a/mix/CodeEditorExtensionMan.cpp +++ b/mix/CodeEditorExtensionMan.cpp @@ -8,7 +8,7 @@ #include "CodeEditorExtensionMan.h" #include "ConstantCompilation.h" #include "features.h" -#include "ApplicationContext.h" +#include "ApplicationCtx.h" #include using namespace dev; diff --git a/mix/ConstantCompilation.cpp b/mix/ConstantCompilation.cpp index 76fbd1546..8a2d14af9 100644 --- a/mix/ConstantCompilation.cpp +++ b/mix/ConstantCompilation.cpp @@ -29,7 +29,7 @@ void ConstantCompilation::start() QString ConstantCompilation::title() { - return "compilation"; + return "compiler"; } void ConstantCompilation::compile() @@ -60,8 +60,8 @@ void ConstantCompilation::compile() content = "Uncaught exception."; this->writeOutPut(false, content); } - } + void ConstantCompilation::writeOutPut(bool _success, QString _content){ QObject* status = m_view->findChild("status", Qt::FindChildrenRecursively); QObject* content = m_view->findChild("content", Qt::FindChildrenRecursively); @@ -70,13 +70,13 @@ void ConstantCompilation::writeOutPut(bool _success, QString _content){ content->setProperty("text", ""); } else if (_success){ - status->setProperty("text", "compile successfull"); + status->setProperty("text", "succeeded"); status->setProperty("color", "green"); content->setProperty("text", _content); - qDebug() << QString("compile suceeded " + _content); + qDebug() << QString("compile succeeded " + _content); } else { - status->setProperty("text", "compile failed"); + status->setProperty("text", "failure"); status->setProperty("color", "red"); content->setProperty("text", _content); qDebug() << QString("compile failed " + _content); diff --git a/mix/ConstantCompilation.h b/mix/ConstantCompilation.h index c3c93b8aa..ed99c6a5f 100644 --- a/mix/ConstantCompilation.h +++ b/mix/ConstantCompilation.h @@ -1,3 +1,25 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file ConstantCompilation.h + * @author Yann yann@ethdev.com + * @date 2014 + * Ethereum IDE client. + */ + #ifndef CONSTANTCOMPILATION_H #define CONSTANTCOMPILATION_H diff --git a/mix/Feature.cpp b/mix/Feature.cpp index 028dca8bd..f3239252f 100644 --- a/mix/Feature.cpp +++ b/mix/Feature.cpp @@ -1,5 +1,5 @@ #include "Feature.h" -#include "ApplicationContext.h" +#include "ApplicationCtx.h" #include #include #include @@ -16,8 +16,8 @@ void Feature::addContentOn(QObject* tabView) { QVariant returnValue; QQmlComponent* component = new QQmlComponent( - ApplicationContext::GetInstance()->appEngine(), - QUrl(this->tabUrl())); + ApplicationCtx::GetInstance()->appEngine(), + QUrl(this->tabUrl()), tabView); QMetaObject::invokeMethod(tabView, "addTab", Q_RETURN_ARG(QVariant, returnValue), @@ -25,6 +25,7 @@ void Feature::addContentOn(QObject* tabView) { Q_ARG(QVariant, QVariant::fromValue(component))); m_view = qvariant_cast(returnValue); + } catch (dev::Exception const& exception){ qDebug() << exception.what(); diff --git a/mix/Feature.h b/mix/Feature.h index 5a51f928d..7a53f3a44 100644 --- a/mix/Feature.h +++ b/mix/Feature.h @@ -1,3 +1,25 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file Feature.h + * @author Yann yann@ethdev.com + * @date 2014 + * Ethereum IDE client. + */ + #ifndef FEATURE_H #define FEATURE_H diff --git a/mix/MainContent.qml b/mix/MainContent.qml index d1170b185..abae4a37f 100644 --- a/mix/MainContent.qml +++ b/mix/MainContent.qml @@ -24,6 +24,13 @@ Rectangle { font.pointSize: 9 width: parent.width anchors.centerIn: parent + tabChangesFocus: false + Keys.onPressed: { + if (event.key === Qt.Key_Tab) { + codeEditor.insert(codeEditor.cursorPosition, "\t"); + event.accepted = true; + } + } } } Rectangle { diff --git a/mix/main.cpp b/mix/main.cpp index 3aa0cb85a..088830c3c 100644 --- a/mix/main.cpp +++ b/mix/main.cpp @@ -1,8 +1,30 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file main.cpp + * @author Yann yann@ethdev.com + * @date 2014 + * Ethereum IDE client. + */ + #include #include #include #include "CodeEditorExtensionMan.h" -#include "ApplicationContext.h" +#include "ApplicationCtx.h" int main(int argc, char *argv[]) { @@ -10,8 +32,8 @@ int main(int argc, char *argv[]) QQmlApplicationEngine* engine = new QQmlApplicationEngine(); qmlRegisterType("CodeEditorExtensionManager", 1, 0, "CodeEditorExtensionManager"); - ApplicationContext::SetApplicationContext(engine); - QObject::connect(&app, SIGNAL(lastWindowClosed()), ApplicationContext::GetInstance(), SLOT(QuitApplication())); //use to kill ApplicationContext and other stuff + ApplicationCtx::SetApplicationContext(engine); + QObject::connect(&app, SIGNAL(lastWindowClosed()), ApplicationCtx::GetInstance(), SLOT(QuitApplication())); //use to kill ApplicationContext and other stuff engine->load(QUrl(QStringLiteral("qrc:/main.qml"))); return app.exec();