Browse Source

misc

cl-refactor
yann300 10 years ago
parent
commit
d97c0b5141
  1. 2
      mix/CMakeLists.txt
  2. 16
      mix/CodeEditorExtensionMan.cpp
  3. 9
      mix/CodeEditorExtensionMan.h
  4. 11
      mix/ConstantCompilation.cpp
  5. 6
      mix/ConstantCompilation.h
  6. 1
      mix/Feature.cpp
  7. 1
      mix/Feature.h

2
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)

16
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: ";

9
mix/CodeEditorExtensionMan.h

@ -20,11 +20,12 @@
* Ethereum IDE client.
*/
#ifndef CODEEDITOREXTENSIONMANAGER_H
#define CODEEDITOREXTENSIONMANAGER_H
#ifndef CODEEDITOREXTENSIONMAN_H
#define CODEEDITOREXTENSIONMAN_H
#include <QQuickItem>
#include <QTextDocument>
#include <QVector>
#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<Feature*> m_features;
QQuickItem* m_tabView;
QTextDocument* m_doc;
void loadEditor(QQuickItem*);
};
#endif // CODEEDITOREXTENSIONMANAGER_H
#endif // CODEEDITOREXTENSIONMAN_H

11
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()

6
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;

1
mix/Feature.cpp

@ -47,7 +47,6 @@ void Feature::addContentOn(QObject* tabView) {
Q_ARG(QVariant, QVariant::fromValue(component)));
m_view = qvariant_cast<QObject*>(returnValue);
}
catch (dev::Exception const& exception){
qDebug() << exception.what();

1
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:

Loading…
Cancel
Save