Browse Source

misc corrections

cl-refactor
yann300 10 years ago
committed by yann300
parent
commit
0e391e50a2
  1. 6
      mix/ApplicationCtx.cpp
  2. 4
      mix/ApplicationCtx.h
  3. 11
      mix/CodeEditorExtensionManager.cpp
  4. 2
      mix/CodeEditorExtensionManager.h
  5. 2
      mix/ConstantCompilationCtrl.cpp
  6. 4
      mix/ConstantCompilationCtrl.h
  7. 2
      mix/Extension.h
  8. 4
      mix/MixApplication.cpp
  9. 2
      mix/MixApplication.h

6
mix/ApplicationCtx.cpp

@ -28,3 +28,9 @@ QQmlApplicationEngine* ApplicationCtx::appEngine()
{ {
return m_applicationEngine; return m_applicationEngine;
} }
void ApplicationCtx::setApplicationContext(QQmlApplicationEngine* _engine)
{
if (Instance == nullptr)
Instance = new ApplicationCtx(_engine);
}

4
mix/ApplicationCtx.h

@ -31,7 +31,7 @@ namespace dev
namespace mix namespace mix
{ {
class ApplicationCtx : public QObject class ApplicationCtx: public QObject
{ {
Q_OBJECT Q_OBJECT
@ -39,7 +39,7 @@ public:
ApplicationCtx(QQmlApplicationEngine* _engine) { m_applicationEngine = _engine; } ApplicationCtx(QQmlApplicationEngine* _engine) { m_applicationEngine = _engine; }
~ApplicationCtx() { delete m_applicationEngine; } ~ApplicationCtx() { delete m_applicationEngine; }
static ApplicationCtx* getInstance() { return Instance; } static ApplicationCtx* getInstance() { return Instance; }
static void setApplicationContext(QQmlApplicationEngine* _engine) { Instance = new ApplicationCtx(_engine); } static void setApplicationContext(QQmlApplicationEngine* _engine);
QQmlApplicationEngine* appEngine(); QQmlApplicationEngine* appEngine();
private: private:

11
mix/CodeEditorExtensionManager.cpp

@ -62,13 +62,12 @@ void CodeEditorExtensionManager::loadEditor(QQuickItem* _editor)
void CodeEditorExtensionManager::initExtensions() void CodeEditorExtensionManager::initExtensions()
{ {
//only one for now //only one for now
std::shared_ptr<ConstantCompilationCtrl> m_constantCompilation(new ConstantCompilationCtrl(m_doc)); std::shared_ptr<ConstantCompilationCtrl> constantCompilation = std::make_shared<ConstantCompilationCtrl>(m_doc);
ConstantCompilationCtrl* ext = m_constantCompilation.get(); if (constantCompilation.get()->contentUrl() != "")
if (ext->contentUrl() != "")
{ {
try try
{ {
ext->addContentOn(m_tabView); constantCompilation.get()->addContentOn(m_tabView);
} }
catch (...) catch (...)
{ {
@ -76,8 +75,8 @@ void CodeEditorExtensionManager::initExtensions()
return; return;
} }
} }
ext->start(); constantCompilation.get()->start();
m_features.append(m_constantCompilation); m_features.append(constantCompilation);
} }
void CodeEditorExtensionManager::setEditor(QQuickItem* _editor) void CodeEditorExtensionManager::setEditor(QQuickItem* _editor)

2
mix/CodeEditorExtensionManager.h

@ -34,7 +34,7 @@ namespace dev
namespace mix namespace mix
{ {
class CodeEditorExtensionManager : public QObject class CodeEditorExtensionManager: public QObject
{ {
Q_OBJECT Q_OBJECT

2
mix/ConstantCompilationCtrl.cpp

@ -76,7 +76,7 @@ void ConstantCompilationCtrl::resetOutPut()
content->setProperty("text", ""); content->setProperty("text", "");
} }
void ConstantCompilationCtrl::writeOutPut(CompilerResult _res) void ConstantCompilationCtrl::writeOutPut(const CompilerResult& _res)
{ {
QObject* status = m_view->findChild<QObject*>("status", Qt::FindChildrenRecursively); QObject* status = m_view->findChild<QObject*>("status", Qt::FindChildrenRecursively);
QObject* content = m_view->findChild<QObject*>("content", Qt::FindChildrenRecursively); QObject* content = m_view->findChild<QObject*>("content", Qt::FindChildrenRecursively);

4
mix/ConstantCompilationCtrl.h

@ -29,7 +29,7 @@ namespace dev
namespace mix namespace mix
{ {
class ConstantCompilationCtrl : public Extension class ConstantCompilationCtrl: public Extension
{ {
Q_OBJECT Q_OBJECT
@ -43,7 +43,7 @@ public:
private: private:
QTextDocument* m_editor; QTextDocument* m_editor;
ConstantCompilationModel* m_compilationModel; ConstantCompilationModel* m_compilationModel;
void writeOutPut(CompilerResult); void writeOutPut(const CompilerResult&);
void resetOutPut(); void resetOutPut();
public Q_SLOTS: public Q_SLOTS:

2
mix/Extension.h

@ -28,7 +28,7 @@ namespace dev
namespace mix namespace mix
{ {
class Extension : public QObject class Extension: public QObject
{ {
Q_OBJECT Q_OBJECT

4
mix/MixApplication.cpp

@ -38,5 +38,9 @@ bool MixApplication::notify(QObject* _receiver, QEvent* _event)
{ {
qDebug() << "std::exception was caught " << _ex.what(); qDebug() << "std::exception was caught " << _ex.what();
} }
catch (...)
{
qDebug() << "uncaught exception ";
}
return false; return false;
} }

2
mix/MixApplication.h

@ -31,7 +31,7 @@ namespace dev
namespace mix namespace mix
{ {
class MixApplication : public QApplication class MixApplication: public QApplication
{ {
Q_OBJECT Q_OBJECT

Loading…
Cancel
Save