From 0e391e50a214537431deeab6dd21868ab8d641d6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 28 Nov 2014 14:52:08 +0100 Subject: [PATCH] misc corrections --- mix/ApplicationCtx.cpp | 6 ++++++ mix/ApplicationCtx.h | 4 ++-- mix/CodeEditorExtensionManager.cpp | 11 +++++------ mix/CodeEditorExtensionManager.h | 2 +- mix/ConstantCompilationCtrl.cpp | 2 +- mix/ConstantCompilationCtrl.h | 4 ++-- mix/Extension.h | 2 +- mix/MixApplication.cpp | 4 ++++ mix/MixApplication.h | 2 +- 9 files changed, 23 insertions(+), 14 deletions(-) diff --git a/mix/ApplicationCtx.cpp b/mix/ApplicationCtx.cpp index 8ea8bd8d8..5b8c34aaf 100644 --- a/mix/ApplicationCtx.cpp +++ b/mix/ApplicationCtx.cpp @@ -28,3 +28,9 @@ QQmlApplicationEngine* ApplicationCtx::appEngine() { return m_applicationEngine; } + +void ApplicationCtx::setApplicationContext(QQmlApplicationEngine* _engine) +{ + if (Instance == nullptr) + Instance = new ApplicationCtx(_engine); +} diff --git a/mix/ApplicationCtx.h b/mix/ApplicationCtx.h index 32e2bd3f1..3938c7bf5 100644 --- a/mix/ApplicationCtx.h +++ b/mix/ApplicationCtx.h @@ -31,7 +31,7 @@ namespace dev namespace mix { -class ApplicationCtx : public QObject +class ApplicationCtx: public QObject { Q_OBJECT @@ -39,7 +39,7 @@ public: ApplicationCtx(QQmlApplicationEngine* _engine) { m_applicationEngine = _engine; } ~ApplicationCtx() { delete m_applicationEngine; } static ApplicationCtx* getInstance() { return Instance; } - static void setApplicationContext(QQmlApplicationEngine* _engine) { Instance = new ApplicationCtx(_engine); } + static void setApplicationContext(QQmlApplicationEngine* _engine); QQmlApplicationEngine* appEngine(); private: diff --git a/mix/CodeEditorExtensionManager.cpp b/mix/CodeEditorExtensionManager.cpp index 316c37ee0..92400cd63 100644 --- a/mix/CodeEditorExtensionManager.cpp +++ b/mix/CodeEditorExtensionManager.cpp @@ -62,13 +62,12 @@ void CodeEditorExtensionManager::loadEditor(QQuickItem* _editor) void CodeEditorExtensionManager::initExtensions() { //only one for now - std::shared_ptr m_constantCompilation(new ConstantCompilationCtrl(m_doc)); - ConstantCompilationCtrl* ext = m_constantCompilation.get(); - if (ext->contentUrl() != "") + std::shared_ptr constantCompilation = std::make_shared(m_doc); + if (constantCompilation.get()->contentUrl() != "") { try { - ext->addContentOn(m_tabView); + constantCompilation.get()->addContentOn(m_tabView); } catch (...) { @@ -76,8 +75,8 @@ void CodeEditorExtensionManager::initExtensions() return; } } - ext->start(); - m_features.append(m_constantCompilation); + constantCompilation.get()->start(); + m_features.append(constantCompilation); } void CodeEditorExtensionManager::setEditor(QQuickItem* _editor) diff --git a/mix/CodeEditorExtensionManager.h b/mix/CodeEditorExtensionManager.h index c368a9714..1d8fb1ec5 100644 --- a/mix/CodeEditorExtensionManager.h +++ b/mix/CodeEditorExtensionManager.h @@ -34,7 +34,7 @@ namespace dev namespace mix { -class CodeEditorExtensionManager : public QObject +class CodeEditorExtensionManager: public QObject { Q_OBJECT diff --git a/mix/ConstantCompilationCtrl.cpp b/mix/ConstantCompilationCtrl.cpp index 0f73da781..2c42a28dd 100644 --- a/mix/ConstantCompilationCtrl.cpp +++ b/mix/ConstantCompilationCtrl.cpp @@ -76,7 +76,7 @@ void ConstantCompilationCtrl::resetOutPut() content->setProperty("text", ""); } -void ConstantCompilationCtrl::writeOutPut(CompilerResult _res) +void ConstantCompilationCtrl::writeOutPut(const CompilerResult& _res) { QObject* status = m_view->findChild("status", Qt::FindChildrenRecursively); QObject* content = m_view->findChild("content", Qt::FindChildrenRecursively); diff --git a/mix/ConstantCompilationCtrl.h b/mix/ConstantCompilationCtrl.h index 3bb221b3d..af7c97951 100644 --- a/mix/ConstantCompilationCtrl.h +++ b/mix/ConstantCompilationCtrl.h @@ -29,7 +29,7 @@ namespace dev namespace mix { -class ConstantCompilationCtrl : public Extension +class ConstantCompilationCtrl: public Extension { Q_OBJECT @@ -43,7 +43,7 @@ public: private: QTextDocument* m_editor; ConstantCompilationModel* m_compilationModel; - void writeOutPut(CompilerResult); + void writeOutPut(const CompilerResult&); void resetOutPut(); public Q_SLOTS: diff --git a/mix/Extension.h b/mix/Extension.h index 3a401eeeb..0678fdd5b 100644 --- a/mix/Extension.h +++ b/mix/Extension.h @@ -28,7 +28,7 @@ namespace dev namespace mix { -class Extension : public QObject +class Extension: public QObject { Q_OBJECT diff --git a/mix/MixApplication.cpp b/mix/MixApplication.cpp index fa9feadb5..634b3142a 100644 --- a/mix/MixApplication.cpp +++ b/mix/MixApplication.cpp @@ -38,5 +38,9 @@ bool MixApplication::notify(QObject* _receiver, QEvent* _event) { qDebug() << "std::exception was caught " << _ex.what(); } + catch (...) + { + qDebug() << "uncaught exception "; + } return false; } diff --git a/mix/MixApplication.h b/mix/MixApplication.h index 3f4ace5a6..ba344fcdc 100644 --- a/mix/MixApplication.h +++ b/mix/MixApplication.h @@ -31,7 +31,7 @@ namespace dev namespace mix { -class MixApplication : public QApplication +class MixApplication: public QApplication { Q_OBJECT