diff --git a/mix/CMakeLists.txt b/mix/CMakeLists.txt index 7272c4d99..6bcb76704 100644 --- a/mix/CMakeLists.txt +++ b/mix/CMakeLists.txt @@ -10,7 +10,7 @@ elseif ("${TARGET_PLATFORM}" STREQUAL "w64") set(SRC_LIST ${SRC_LIST} ../windows/qt_plugin_import.cpp) include_directories(/usr/x86_64-w64-mingw32/include /usr/x86_64-w64-mingw32/include/QtCore /usr/x86_64-w64-mingw32/include/QtGui /usr/x86_64-w64-mingw32/include/QtQuick /usr/x86_64-w64-mingw32/include/QtQml /usr/x86_64-w64-mingw32/include/QtNetwork /usr/x86_64-w64-mingw32/include/QtWidgets /usr/x86_64-w64-mingw32/include/QtWebKit /usr/x86_64-w64-mingw32/include/QtWebKitWidgets) elseif (UNIX) - set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ";$ENV{QTDIR}/lib/cmake" /opt/Qt5.3.2/5.3/gcc_64/lib/cmake/Qt5Declarative) + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ";$ENV{QTDIR}/lib/cmake") endif () find_package(Qt5Core REQUIRED) diff --git a/mix/CodeEditorExtensionMan.cpp b/mix/CodeEditorExtensionMan.cpp index d1ad6c075..6e2c72c7f 100644 --- a/mix/CodeEditorExtensionMan.cpp +++ b/mix/CodeEditorExtensionMan.cpp @@ -38,6 +38,13 @@ CodeEditorExtensionManager::CodeEditorExtensionManager() { } +CodeEditorExtensionManager::~CodeEditorExtensionManager() +{ + for (int k = 0; k < m_features.length(); k++){ + delete m_features.at(k); + } +} + void CodeEditorExtensionManager::loadEditor(QQuickItem* _editor) { if (!_editor) @@ -61,10 +68,11 @@ void CodeEditorExtensionManager::initExtensions() { try{ //only one for now - ConstantCompilation* compil = new ConstantCompilation(m_doc); - if (compil->tabUrl() != "") - compil->addContentOn(m_tabView); - compil->start(); + ConstantCompilation* m_constantCompilation = new ConstantCompilation(m_doc); + if (m_constantCompilation->tabUrl() != "") + m_constantCompilation->addContentOn(m_tabView); + m_constantCompilation->start(); + m_features.append(m_constantCompilation); } catch (dev::Exception const& exception){ qDebug() << "unable to load extensions: "; diff --git a/mix/CodeEditorExtensionMan.h b/mix/CodeEditorExtensionMan.h index 32f435338..306392254 100644 --- a/mix/CodeEditorExtensionMan.h +++ b/mix/CodeEditorExtensionMan.h @@ -20,11 +20,12 @@ * Ethereum IDE client. */ -#ifndef CODEEDITOREXTENSIONMANAGER_H -#define CODEEDITOREXTENSIONMANAGER_H +#ifndef CODEEDITOREXTENSIONMAN_H +#define CODEEDITOREXTENSIONMAN_H #include #include +#include #include "Feature.h" class CodeEditorExtensionManager : public QObject @@ -36,15 +37,17 @@ class CodeEditorExtensionManager : public QObject public: CodeEditorExtensionManager(); + ~CodeEditorExtensionManager(); void initExtensions(); void setEditor(QQuickItem*); void setTabView(QQuickItem*); private: QQuickItem* m_editor; + QVector m_features; QQuickItem* m_tabView; QTextDocument* m_doc; void loadEditor(QQuickItem*); }; -#endif // CODEEDITOREXTENSIONMANAGER_H +#endif // CODEEDITOREXTENSIONMAN_H diff --git a/mix/ConstantCompilation.cpp b/mix/ConstantCompilation.cpp index 72e7b2bfe..3ed687177 100644 --- a/mix/ConstantCompilation.cpp +++ b/mix/ConstantCompilation.cpp @@ -40,18 +40,19 @@ ConstantCompilation::ConstantCompilation(QTextDocument* _doc) m_editor = _doc; } -QString ConstantCompilation::tabUrl(){ +QString ConstantCompilation::tabUrl() +{ return QStringLiteral("qrc:/qml/BasicContent.qml"); } -void ConstantCompilation::start() +QString ConstantCompilation::title() { - connect(m_editor, SIGNAL(contentsChange(int,int,int)), this, SLOT(compile())); + return "compiler"; } -QString ConstantCompilation::title() +void ConstantCompilation::start() { - return "compiler"; + connect(m_editor, SIGNAL(contentsChange(int,int,int)), this, SLOT(compile())); } void ConstantCompilation::compile() diff --git a/mix/ConstantCompilation.h b/mix/ConstantCompilation.h index ed99c6a5f..974277d2a 100644 --- a/mix/ConstantCompilation.h +++ b/mix/ConstantCompilation.h @@ -32,9 +32,9 @@ class ConstantCompilation : public Feature public: ConstantCompilation(QTextDocument* doc); - void start(); - QString title(); - QString tabUrl(); + void start() override; + QString title() override; + QString tabUrl() override; private: QTextDocument* m_editor; diff --git a/mix/Feature.cpp b/mix/Feature.cpp index 309cf7eff..747b538d8 100644 --- a/mix/Feature.cpp +++ b/mix/Feature.cpp @@ -47,7 +47,6 @@ 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 7a53f3a44..d5cee7e74 100644 --- a/mix/Feature.h +++ b/mix/Feature.h @@ -34,6 +34,7 @@ public: Feature(); virtual QString tabUrl() { return ""; } virtual QString title() { return ""; } + virtual void start() {} void addContentOn(QObject* tabView); protected: