working menu item

This commit is contained in:
Ryan Jones 2016-12-03 19:34:38 -08:00
parent 10c054165f
commit 3eecba77f2
6 changed files with 78 additions and 1 deletions

View file

@ -589,7 +589,9 @@ Menu::Menu() {
#endif
// Developer >> Tests >>>
MenuWrapper* testMenu = developerMenu->addMenu("Tests");
addActionToQMenuAndActionHash(testMenu, MenuOption::RunClientScriptTests, 0, dialogsManager.data(), SLOT(showTestingResults()));
// Developer > Timing >>>
MenuWrapper* timingMenu = developerMenu->addMenu("Timing");

View file

@ -172,6 +172,7 @@ namespace MenuOption {
const QString ResetAvatarSize = "Reset Avatar Size";
const QString ResetSensors = "Reset Sensors";
const QString RunningScripts = "Running Scripts...";
const QString RunClientScriptTests = "Run Client Script Tests";
const QString RunTimingTests = "Run Timing Tests";
const QString ScriptEditor = "Script Editor...";
const QString ScriptedMotorControl = "Enable Scripted Motor Control";

View file

@ -158,6 +158,15 @@ void DialogsManager::showScriptEditor() {
_scriptEditor->raise();
}
void DialogsManager::showTestingResults() {
if (!_testingDialog) {
_testingDialog = new TestingDialog(qApp->getWindow());
connect(_testingDialog, SIGNAL(closed()), _testingDialog, SLOT(deleteLater()));
}
_testingDialog->show();
_testingDialog->raise();
}
void DialogsManager::showDomainConnectionDialog() {
// if the dialog already exists we delete it so the connection data is refreshed
if (_domainConnectionDialog) {

View file

@ -17,6 +17,7 @@
#include <DependencyManager.h>
#include "HMDToolsDialog.h"
#include "TestingDialog.h"
class AnimationsDialog;
class AttachmentsDialog;
@ -26,6 +27,7 @@ class DiskCacheEditor;
class LodToolsDialog;
class OctreeStatsDialog;
class ScriptEditorWindow;
class TestingDialog;
class QMessageBox;
class DomainConnectionDialog;
@ -38,6 +40,7 @@ public:
QPointer<HMDToolsDialog> getHMDToolsDialog() const { return _hmdToolsDialog; }
QPointer<LodToolsDialog> getLodToolsDialog() const { return _lodToolsDialog; }
QPointer<OctreeStatsDialog> getOctreeStatsDialog() const { return _octreeStatsDialog; }
QPointer<TestingDialog> getTestingDialog() const { return _testingDialog; }
void emitAddressBarShown(bool visible) { emit addressBarShown(visible); }
public slots:
@ -55,6 +58,7 @@ public slots:
void hmdTools(bool showTools);
void showScriptEditor();
void showDomainConnectionDialog();
void showTestingResults();
// Application Update
void showUpdateDialog();
@ -83,6 +87,7 @@ private:
QPointer<LodToolsDialog> _lodToolsDialog;
QPointer<OctreeStatsDialog> _octreeStatsDialog;
QPointer<ScriptEditorWindow> _scriptEditor;
QPointer<TestingDialog> _testingDialog;
QPointer<DomainConnectionDialog> _domainConnectionDialog;
};

View file

@ -0,0 +1,35 @@
//
// TestingDialog.cpp
// interface/src/ui
//
// Created by Ryan Jones on 12/3/2016.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <ScriptEngines.h>
#include "ui/TestingDialog.h"
#include "Application.h"
TestingDialog::TestingDialog(QWidget* parent) :
QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint)
{
DependencyManager::get<ScriptEngines>()->loadOneScript(qApp->applicationDirPath() + testRunnerRelativePath);
this->setWindowTitle(windowLabel);
}
TestingDialog::~TestingDialog() {
// TODO: Clean up here?
}
void TestingDialog::reject() {
this->QDialog::close();
}
void TestingDialog::closeEvent(QCloseEvent* event) {
this->QDialog::closeEvent(event);
emit closed();
}

View file

@ -0,0 +1,25 @@
#ifndef hifi_TestingDialog_h
#define hifi_TestingDialog_h
#include <QDialog>
const QString windowLabel = "Testing Dialog";
const QString testRunnerRelativePath = "/scripts/developer/tests/bindUnitTest.js";
class TestingDialog : public QDialog {
Q_OBJECT
public:
TestingDialog(QWidget* parent);
~TestingDialog();
signals:
void closed();
public slots:
void reject() override;
protected:
void closeEvent(QCloseEvent*) override;
};
#endif