From ddd44edebd85c5becc7f29a376078118e7fce1dc Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 8 Feb 2019 01:23:59 +0100 Subject: [PATCH] Ref T528, test if simulator interface can be used (only possible in local UI, not in remote UI) --- src/blackcore/application.cpp | 10 ++++++++-- src/blackcore/application.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/blackcore/application.cpp b/src/blackcore/application.cpp index fefa49e80..220840c9c 100644 --- a/src/blackcore/application.cpp +++ b/src/blackcore/application.cpp @@ -1434,11 +1434,17 @@ namespace BlackCore QPointer CApplication::getISimulator() const { - if (!this->getCoreFacade()) { return nullptr; } - if (!this->getCoreFacade()->getCContextSimulator()) { return nullptr; } + if (!this->hasSimulator()) { return nullptr; } return this->getCoreFacade()->getCContextSimulator()->simulator(); } + bool CApplication::hasSimulator() const + { + if (!this->getCoreFacade()) { return false; } + if (!this->getCoreFacade()->getIContextSimulator()->isUsingImplementingObject()) { return false; } + return (this->getCoreFacade()->getCContextSimulator()); // should always be true + } + void CApplication::cmdLineHelpMessage() { m_parser.showHelp(); // terminates diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 209e16437..2455ba397 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -331,6 +331,9 @@ namespace BlackCore //! The simulator plugin, if available QPointer getISimulator() const; + //! Simulator object available? + bool hasSimulator() const; + // ----------------------- contexts ---------------------------------------- //! \name Context / core facade related