Showing the changes to interface/src/ui/TestingDialog.cpp (1 of 7 files). Show all
Unified · Split
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html |
| 10 | 10 | // |
| 11 | 11 | |
| 12 | −#include <ScriptEngines.h> | |
| 12 | +#include "ScriptEngines.h" | |
| 13 | 13 | |
| 14 | 14 | #include "ui/TestingDialog.h" |
| 15 | 15 | #include "Application.h" |
| @@ -17,19 +17,23 @@ · 1 unmodified line | ||
| 17 | 17 | TestingDialog::TestingDialog(QWidget* parent) : |
| 18 | 18 | QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint) |
| 19 | 19 | { |
| 20 | − DependencyManager::get<ScriptEngines>()->loadOneScript(qApp->applicationDirPath() + testRunnerRelativePath); | |
| 21 | − this->setWindowTitle(windowLabel); | |
| 22 | −} | |
| 20 | + setAttribute(Qt::WA_DeleteOnClose); | |
| 21 | + setWindowTitle(windowLabel); | |
| 23 | 22 | |
| 24 | −TestingDialog::~TestingDialog() { | |
| 25 | − // TODO: Clean up here? | |
| 23 | + _console = new JSConsole(this); | |
| 24 | + _console->setFixedHeight(TESTING_CONSOLE_HEIGHT); | |
| 25 | + | |
| 26 | + auto _engines = DependencyManager::get<ScriptEngines>(); | |
| 27 | + _engine = _engines->loadScript(qApp->applicationDirPath() + testRunnerRelativePath); | |
| 28 | + _console->setScriptEngine(_engine); | |
| 29 | + connect(_engine, &ScriptEngine::finished, this, &TestingDialog::onTestingFinished); | |
| 26 | 30 | } |
| 27 | 31 | |
| 28 | −void TestingDialog::reject() { | |
| 29 | − this->QDialog::close(); | |
| 32 | +TestingDialog::~TestingDialog() { | |
| 33 | + delete _console; | |
| 30 | 34 | } |
| 31 | 35 | |
| 32 | −void TestingDialog::closeEvent(QCloseEvent* event) { | |
| 33 | − this->QDialog::closeEvent(event); | |
| 34 | − emit closed(); | |
| 36 | +void TestingDialog::onTestingFinished(const QString& scriptPath) { | |
| 37 | + _engine = NULL; | |
| 38 | + _console->setScriptEngine(NULL); | |
| 35 | 39 | } |