mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 07:12:40 +02:00
Replace Application::getInstance() with qApp
This commit is contained in:
parent
2c276bb13e
commit
cf3b33a96b
37 changed files with 197 additions and 181 deletions
|
@ -191,7 +191,7 @@ void OctreeServer::trackPacketSendingTime(float time) {
|
|||
}
|
||||
|
||||
|
||||
void OctreeServer::trackProcessWaitTime(float time) {
|
||||
void OctreeServer::trackProcessWaitTime(float time)
|
||||
const float MAX_SHORT_TIME = 10.0f;
|
||||
const float MAX_LONG_TIME = 100.0f;
|
||||
if (time == SKIP_TIME) {
|
||||
|
|
|
@ -218,11 +218,11 @@ public:
|
|||
}
|
||||
|
||||
if (message->message == UWM_SHOW_APPLICATION) {
|
||||
MainWindow* applicationWindow = Application::getInstance()->getWindow();
|
||||
MainWindow* applicationWindow = qApp->getWindow();
|
||||
if (applicationWindow->isMinimized()) {
|
||||
applicationWindow->showNormal(); // Restores to windowed or maximized state appropriately.
|
||||
}
|
||||
Application::getInstance()->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.
|
||||
qApp->setActiveWindow(applicationWindow); // Flashes the taskbar icon if not focus.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
|
|||
OutputDebugStringA(logMessage.toLocal8Bit().constData());
|
||||
OutputDebugStringA("\n");
|
||||
#endif
|
||||
Application::getInstance()->getLogger()->addMessage(qPrintable(logMessage + "\n"));
|
||||
qApp->getLogger()->addMessage(qPrintable(logMessage + "\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1104,7 +1104,7 @@ void Application::paintGL() {
|
|||
PerformanceTimer perfTimer("renderOverlay");
|
||||
// NOTE: There is no batch associated with this renderArgs
|
||||
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
||||
QSize size = qApp->getDeviceSize();
|
||||
QSize size = getDeviceSize();
|
||||
renderArgs._viewport = glm::ivec4(0, 0, size.width(), size.height());
|
||||
_applicationOverlay.renderOverlay(&renderArgs);
|
||||
}
|
||||
|
@ -1116,7 +1116,7 @@ void Application::paintGL() {
|
|||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(_myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
||||
Application::getInstance()->cameraMenuChanged();
|
||||
cameraMenuChanged();
|
||||
}
|
||||
|
||||
// The render mode is default or mirror if the camera is in mirror mode, assigned further below
|
||||
|
@ -3561,7 +3561,7 @@ namespace render {
|
|||
|
||||
skybox = skyStage->getSkybox();
|
||||
if (skybox) {
|
||||
skybox->render(batch, *(Application::getInstance()->getDisplayViewFrustum()));
|
||||
skybox->render(batch, *(qApp->getDisplayViewFrustum()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4526,7 +4526,7 @@ void Application::loadDialog() {
|
|||
}
|
||||
|
||||
void Application::loadScriptURLDialog() {
|
||||
QInputDialog scriptURLDialog(Application::getInstance()->getWindow());
|
||||
QInputDialog scriptURLDialog(getWindow());
|
||||
scriptURLDialog.setWindowTitle("Open and Run Script URL");
|
||||
scriptURLDialog.setLabelText("Script:");
|
||||
scriptURLDialog.setWindowFlags(Qt::Sheet);
|
||||
|
@ -5095,8 +5095,8 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
|||
|
||||
unsigned int deviceID = index == 0 ? CONTROLLER_0_EVENT : CONTROLLER_1_EVENT;
|
||||
|
||||
if (qApp->isHMDMode()) {
|
||||
pos = qApp->getApplicationCompositor().getPalmClickLocation(palm);
|
||||
if (isHMDMode()) {
|
||||
pos = getApplicationCompositor().getPalmClickLocation(palm);
|
||||
}
|
||||
else {
|
||||
// Get directon relative to avatar orientation
|
||||
|
@ -5105,7 +5105,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
|||
// Get the angles, scaled between (-0.5,0.5)
|
||||
float xAngle = (atan2f(direction.z, direction.x) + (float)M_PI_2);
|
||||
float yAngle = 0.5f - ((atan2f(direction.z, direction.y) + (float)M_PI_2));
|
||||
auto canvasSize = qApp->getCanvasSize();
|
||||
auto canvasSize = getCanvasSize();
|
||||
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||
float cursorRange = canvasSize.x * InputDevice::getCursorPixelRangeMult();
|
||||
|
||||
|
@ -5120,14 +5120,14 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
|||
if (_oldHandLeftClick[index]) {
|
||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);
|
||||
|
||||
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
|
||||
_oldHandLeftClick[index] = false;
|
||||
}
|
||||
if (_oldHandRightClick[index]) {
|
||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);
|
||||
|
||||
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
|
||||
_oldHandRightClick[index] = false;
|
||||
}
|
||||
|
@ -5141,7 +5141,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
|||
// Only send the mouse event if the opposite left button isnt held down.
|
||||
// Is this check necessary?
|
||||
if (!_oldHandLeftClick[(int)(!index)]) {
|
||||
qApp->mouseMoveEvent(&mouseEvent, deviceID);
|
||||
mouseMoveEvent(&mouseEvent, deviceID);
|
||||
}
|
||||
}
|
||||
_oldHandMouseX[index] = pos.x();
|
||||
|
@ -5162,12 +5162,12 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
|||
|
||||
QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::RightButton, Qt::RightButton, 0);
|
||||
|
||||
qApp->mousePressEvent(&mouseEvent, deviceID);
|
||||
mousePressEvent(&mouseEvent, deviceID);
|
||||
}
|
||||
} else if (_oldHandRightClick[index]) {
|
||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::RightButton, Qt::RightButton, 0);
|
||||
|
||||
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
|
||||
_oldHandRightClick[index] = false;
|
||||
}
|
||||
|
@ -5179,12 +5179,12 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
|||
|
||||
QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, Qt::LeftButton, Qt::LeftButton, 0);
|
||||
|
||||
qApp->mousePressEvent(&mouseEvent, deviceID);
|
||||
mousePressEvent(&mouseEvent, deviceID);
|
||||
}
|
||||
} else if (_oldHandLeftClick[index]) {
|
||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, Qt::LeftButton, Qt::LeftButton, 0);
|
||||
|
||||
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
mouseReleaseEvent(&mouseEvent, deviceID);
|
||||
|
||||
_oldHandLeftClick[index] = false;
|
||||
}
|
||||
|
|
|
@ -139,11 +139,10 @@ class Application : public QApplication, public AbstractViewStateInterface, publ
|
|||
friend class DatagramProcessor;
|
||||
|
||||
public:
|
||||
static Application* getInstance() { return qApp; } // TODO: replace fully by qApp
|
||||
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
||||
static glm::quat getOrientationForPath() { return getInstance()->_myAvatar->getOrientation(); }
|
||||
static glm::vec3 getPositionForAudio() { return getInstance()->_myAvatar->getPositionForAudio(); }
|
||||
static glm::quat getOrientationForAudio() { return getInstance()->_myAvatar->getOrientationForAudio(); }
|
||||
static const glm::vec3& getPositionForPath() { return qApp->_myAvatar->getPosition(); }
|
||||
static glm::quat getOrientationForPath() { return qApp->_myAvatar->getOrientation(); }
|
||||
static glm::vec3 getPositionForAudio() { return qApp->_myAvatar->getPositionForAudio(); }
|
||||
static glm::quat getOrientationForAudio() { return qApp->_myAvatar->getOrientationForAudio(); }
|
||||
static void initPlugins();
|
||||
static void shutdownPlugins();
|
||||
|
||||
|
|
|
@ -62,13 +62,13 @@ void GLCanvas::paintGL() {
|
|||
// FIXME - I'm not sure why this still remains, it appears as if this GLCanvas gets a single paintGL call near
|
||||
// the beginning of the application starting up. I'm not sure if we really need to call Application::paintGL()
|
||||
// in this case, since the display plugins eventually handle all the painting
|
||||
if (!Application::getInstance()->getWindow()->isMinimized() || !Application::getInstance()->isThrottleFPSEnabled()) {
|
||||
Application::getInstance()->paintGL();
|
||||
if (!qApp->getWindow()->isMinimized() || !qApp->isThrottleFPSEnabled()) {
|
||||
qApp->paintGL();
|
||||
}
|
||||
}
|
||||
|
||||
void GLCanvas::resizeGL(int width, int height) {
|
||||
Application::getInstance()->resizeGL();
|
||||
qApp->resizeGL();
|
||||
}
|
||||
|
||||
int updateTime = 0;
|
||||
|
@ -95,7 +95,7 @@ bool GLCanvas::event(QEvent* event) {
|
|||
break;
|
||||
case QEvent::Paint:
|
||||
// Ignore paint events that occur after we've decided to quit
|
||||
if (Application::getInstance()->isAboutToQuit()) {
|
||||
if (qApp->isAboutToQuit()) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -26,14 +26,14 @@ LODManager::LODManager() {
|
|||
}
|
||||
|
||||
float LODManager::getLODDecreaseFPS() {
|
||||
if (Application::getInstance()->isHMDMode()) {
|
||||
if (qApp->isHMDMode()) {
|
||||
return getHMDLODDecreaseFPS();
|
||||
}
|
||||
return getDesktopLODDecreaseFPS();
|
||||
}
|
||||
|
||||
float LODManager::getLODIncreaseFPS() {
|
||||
if (Application::getInstance()->isHMDMode()) {
|
||||
if (qApp->isHMDMode()) {
|
||||
return getHMDLODIncreaseFPS();
|
||||
}
|
||||
return getDesktopLODIncreaseFPS();
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace render {
|
|||
avatarPtr->setDisplayingLookatTarget(renderLookAtTarget);
|
||||
|
||||
if (avatarPtr->isInitialized() && args) {
|
||||
avatarPtr->render(args, Application::getInstance()->getCamera()->getPosition());
|
||||
avatarPtr->render(args, qApp->getCamera()->getPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ Avatar::Avatar(RigPointer rig) :
|
|||
_voiceSphereID(GeometryCache::UNKNOWN_ID)
|
||||
{
|
||||
// we may have been created in the network thread, but we live in the main thread
|
||||
moveToThread(Application::getInstance()->thread());
|
||||
moveToThread(qApp->thread());
|
||||
|
||||
// give the pointer to our head to inherited _headData variable from AvatarData
|
||||
_headData = static_cast<HeadData*>(new Head(this));
|
||||
|
@ -152,7 +152,7 @@ void Avatar::simulate(float deltaTime) {
|
|||
// update the avatar's position according to its referential
|
||||
if (_referential) {
|
||||
if (_referential->hasExtraData()) {
|
||||
EntityTreePointer tree = Application::getInstance()->getEntities()->getTree();
|
||||
EntityTreePointer tree = qApp->getEntities()->getTree();
|
||||
switch (_referential->type()) {
|
||||
case Referential::MODEL:
|
||||
_referential = new ModelReferential(_referential,
|
||||
|
@ -189,7 +189,7 @@ void Avatar::simulate(float deltaTime) {
|
|||
|
||||
// simple frustum check
|
||||
float boundingRadius = getBillboardSize();
|
||||
bool inViewFrustum = Application::getInstance()->getViewFrustum()->sphereInFrustum(_position, boundingRadius) !=
|
||||
bool inViewFrustum = qApp->getViewFrustum()->sphereInFrustum(_position, boundingRadius) !=
|
||||
ViewFrustum::OUTSIDE;
|
||||
|
||||
{
|
||||
|
@ -388,9 +388,9 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition) {
|
|||
float boundingRadius = getBillboardSize();
|
||||
ViewFrustum* frustum = nullptr;
|
||||
if (renderArgs->_renderMode == RenderArgs::SHADOW_RENDER_MODE) {
|
||||
frustum = Application::getInstance()->getShadowViewFrustum();
|
||||
frustum = qApp->getShadowViewFrustum();
|
||||
} else {
|
||||
frustum = Application::getInstance()->getDisplayViewFrustum();
|
||||
frustum = qApp->getDisplayViewFrustum();
|
||||
}
|
||||
|
||||
if (frustum->sphereInFrustum(getPosition(), boundingRadius) == ViewFrustum::OUTSIDE) {
|
||||
|
@ -539,7 +539,7 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition) {
|
|||
const float DISPLAYNAME_DISTANCE = 20.0f;
|
||||
setShowDisplayName(distanceToTarget < DISPLAYNAME_DISTANCE);
|
||||
|
||||
auto cameraMode = Application::getInstance()->getCamera()->getMode();
|
||||
auto cameraMode = qApp->getCamera()->getMode();
|
||||
if (!isMyAvatar() || cameraMode != CAMERA_MODE_FIRST_PERSON) {
|
||||
renderDisplayName(batch, *renderArgs->_viewFrustum, renderArgs->_viewport);
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ void Avatar::fixupModelsInScene() {
|
|||
|
||||
// check to see if when we added our models to the scene they were ready, if they were not ready, then
|
||||
// fix them up in the scene
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
if (_skeletonModel.isRenderable() && _skeletonModel.needsFixupInScene()) {
|
||||
_skeletonModel.removeFromScene(scene, pendingChanges);
|
||||
|
@ -653,7 +653,7 @@ void Avatar::renderBillboard(RenderArgs* renderArgs) {
|
|||
}
|
||||
// rotate about vertical to face the camera
|
||||
glm::quat rotation = getOrientation();
|
||||
glm::vec3 cameraVector = glm::inverse(rotation) * (Application::getInstance()->getCamera()->getPosition() - _position);
|
||||
glm::vec3 cameraVector = glm::inverse(rotation) * (qApp->getCamera()->getPosition() - _position);
|
||||
rotation = rotation * glm::angleAxis(atan2f(-cameraVector.x, -cameraVector.z), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
|
||||
// compute the size from the billboard camera parameters and scale
|
||||
|
|
|
@ -81,7 +81,7 @@ void AvatarManager::init() {
|
|||
|
||||
connect(DependencyManager::get<SceneScriptingInterface>().data(), &SceneScriptingInterface::shouldRenderAvatarsChanged, this, &AvatarManager::updateAvatarRenderStatus, Qt::QueuedConnection);
|
||||
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
|
||||
_myAvatar->addToScene(_myAvatar, scene, pendingChanges);
|
||||
|
@ -146,7 +146,7 @@ void AvatarManager::simulateAvatarFades(float deltaTime) {
|
|||
const float SHRINK_RATE = 0.9f;
|
||||
const float MIN_FADE_SCALE = 0.001f;
|
||||
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
while (fadingIterator != _avatarFades.end()) {
|
||||
auto avatar = std::static_pointer_cast<Avatar>(*fadingIterator);
|
||||
|
@ -171,7 +171,7 @@ AvatarSharedPointer AvatarManager::newSharedAvatar() {
|
|||
// virtual
|
||||
AvatarSharedPointer AvatarManager::addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) {
|
||||
auto avatar = std::dynamic_pointer_cast<Avatar>(AvatarHashMap::addAvatar(sessionUUID, mixerWeakPointer));
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
|
||||
avatar->addToScene(avatar, scene, pendingChanges);
|
||||
|
@ -328,7 +328,7 @@ void AvatarManager::updateAvatarRenderStatus(bool shouldRenderAvatars) {
|
|||
if (DependencyManager::get<SceneScriptingInterface>()->shouldRenderAvatars()) {
|
||||
for (auto avatarData : _avatarHash) {
|
||||
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarData);
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
avatar->addToScene(avatar, scene, pendingChanges);
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
|
@ -336,7 +336,7 @@ void AvatarManager::updateAvatarRenderStatus(bool shouldRenderAvatars) {
|
|||
} else {
|
||||
for (auto avatarData : _avatarHash) {
|
||||
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarData);
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
avatar->removeFromScene(avatar, scene, pendingChanges);
|
||||
scene->enqueuePendingChanges(pendingChanges);
|
||||
|
|
|
@ -29,11 +29,11 @@ AvatarUpdate::AvatarUpdate() : GenericThread(), _lastAvatarUpdate(0) {
|
|||
void AvatarUpdate::synchronousProcess() {
|
||||
|
||||
// Keep our own updated value, so that our asynchronous code can consult it.
|
||||
_isHMDMode = Application::getInstance()->isHMDMode();
|
||||
_headPose = Application::getInstance()->getActiveDisplayPlugin()->getHeadPose();
|
||||
_isHMDMode = qApp->isHMDMode();
|
||||
_headPose = qApp->getActiveDisplayPlugin()->getHeadPose();
|
||||
|
||||
if (_updateBillboard) {
|
||||
Application::getInstance()->getMyAvatar()->doUpdateBillboard();
|
||||
qApp->getMyAvatar()->doUpdateBillboard();
|
||||
}
|
||||
|
||||
if (!isThreaded()) {
|
||||
|
@ -47,7 +47,7 @@ bool AvatarUpdate::process() {
|
|||
quint64 deltaMicroseconds = start - _lastAvatarUpdate;
|
||||
_lastAvatarUpdate = start;
|
||||
float deltaSeconds = (float) deltaMicroseconds / (float) USECS_PER_SECOND;
|
||||
Application::getInstance()->setAvatarSimrateSample(1.0f / deltaSeconds);
|
||||
qApp->setAvatarSimrateSample(1.0f / deltaSeconds);
|
||||
|
||||
QSharedPointer<AvatarManager> manager = DependencyManager::get<AvatarManager>();
|
||||
MyAvatar* myAvatar = manager->getMyAvatar();
|
||||
|
@ -57,7 +57,7 @@ bool AvatarUpdate::process() {
|
|||
manager->updateOtherAvatars(deltaSeconds);
|
||||
|
||||
myAvatar->startUpdate();
|
||||
Application::getInstance()->updateMyAvatarLookAtPosition();
|
||||
qApp->updateMyAvatarLookAtPosition();
|
||||
// Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
|
||||
manager->updateMyAvatar(deltaSeconds);
|
||||
myAvatar->endUpdate();
|
||||
|
|
|
@ -94,7 +94,7 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
|||
|
||||
// Only use face trackers when not playing back a recording.
|
||||
if (!myAvatar->isPlaying()) {
|
||||
FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();
|
||||
FaceTracker* faceTracker = qApp->getActiveFaceTracker();
|
||||
_isFaceTrackerConnected = faceTracker != NULL && !faceTracker->isMuted();
|
||||
if (_isFaceTrackerConnected) {
|
||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||
|
|
|
@ -126,7 +126,7 @@ MyAvatar::~MyAvatar() {
|
|||
}
|
||||
|
||||
QByteArray MyAvatar::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||
CameraMode mode = Application::getInstance()->getCamera()->getMode();
|
||||
CameraMode mode = qApp->getCamera()->getMode();
|
||||
if (mode == CAMERA_MODE_THIRD_PERSON || mode == CAMERA_MODE_INDEPENDENT) {
|
||||
// fake the avatar position that is sent up to the AvatarMixer
|
||||
glm::vec3 oldPosition = _position;
|
||||
|
@ -374,7 +374,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
return;
|
||||
}
|
||||
|
||||
FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker();
|
||||
FaceTracker* tracker = qApp->getActiveFaceTracker();
|
||||
bool inFacetracker = tracker && !tracker->isMuted();
|
||||
|
||||
if (inHmd) {
|
||||
|
@ -388,7 +388,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
estimatedPosition = tracker->getHeadTranslation();
|
||||
_trackedHeadPosition = estimatedPosition;
|
||||
estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation()));
|
||||
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
if (qApp->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
// Invert yaw and roll when in mirror mode
|
||||
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||
|
@ -442,7 +442,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
|||
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||
// match your body movements.
|
||||
if ((inHmd || inFacetracker) && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
if ((inHmd || inFacetracker) && qApp->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
relativePosition.x = -relativePosition.x;
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ void MyAvatar::clearReferential() {
|
|||
}
|
||||
|
||||
bool MyAvatar::setModelReferential(const QUuid& id) {
|
||||
EntityTreePointer tree = Application::getInstance()->getEntities()->getTree();
|
||||
EntityTreePointer tree = qApp->getEntities()->getTree();
|
||||
changeReferential(new ModelReferential(id, tree, this));
|
||||
if (_referential->isValid()) {
|
||||
return true;
|
||||
|
@ -549,7 +549,7 @@ bool MyAvatar::setModelReferential(const QUuid& id) {
|
|||
}
|
||||
|
||||
bool MyAvatar::setJointReferential(const QUuid& id, int jointIndex) {
|
||||
EntityTreePointer tree = Application::getInstance()->getEntities()->getTree();
|
||||
EntityTreePointer tree = qApp->getEntities()->getTree();
|
||||
changeReferential(new JointReferential(jointIndex, id, tree, this));
|
||||
if (!_referential->isValid()) {
|
||||
return true;
|
||||
|
@ -856,7 +856,7 @@ void MyAvatar::setEnableDebugDrawAnimPose(bool isEnabled) {
|
|||
}
|
||||
|
||||
void MyAvatar::setEnableMeshVisible(bool isEnabled) {
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
_skeletonModel.setVisibleInScene(isEnabled, scene);
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ void MyAvatar::updateLookAtTargetAvatar() {
|
|||
_targetAvatarPosition = glm::vec3(0.0f);
|
||||
|
||||
glm::vec3 lookForward = getHead()->getFinalOrientationInWorldFrame() * IDENTITY_FRONT;
|
||||
glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
||||
glm::vec3 cameraPosition = qApp->getCamera()->getPosition();
|
||||
|
||||
float smallestAngleTo = glm::radians(DEFAULT_FIELD_OF_VIEW_DEGREES) / 2.0f;
|
||||
const float KEEP_LOOKING_AT_CURRENT_ANGLE_FACTOR = 1.3f;
|
||||
|
@ -1023,7 +1023,7 @@ void MyAvatar::updateLookAtTargetAvatar() {
|
|||
_targetAvatarPosition = avatarPointer->getPosition();
|
||||
smallestAngleTo = angleTo;
|
||||
}
|
||||
if (Application::getInstance()->isLookingAtMyAvatar(avatar)) {
|
||||
if (qApp->isLookingAtMyAvatar(avatar)) {
|
||||
|
||||
// Alter their gaze to look directly at my camera; this looks more natural than looking at my avatar's face.
|
||||
glm::vec3 lookAtPosition = avatar->getHead()->getLookAtPosition(); // A position, in world space, on my avatar.
|
||||
|
@ -1035,11 +1035,11 @@ void MyAvatar::updateLookAtTargetAvatar() {
|
|||
// When not in HMD, these might both answer identity (i.e., the bridge of the nose). That's ok.
|
||||
// By my inpsection of the code and live testing, getEyeOffset and getEyePose are the same. (Application hands identity as offset matrix.)
|
||||
// This might be more work than needed for any given use, but as we explore different formulations, we go mad if we don't work in world space.
|
||||
glm::mat4 leftEye = Application::getInstance()->getEyeOffset(Eye::Left);
|
||||
glm::mat4 rightEye = Application::getInstance()->getEyeOffset(Eye::Right);
|
||||
glm::mat4 leftEye = qApp->getEyeOffset(Eye::Left);
|
||||
glm::mat4 rightEye = qApp->getEyeOffset(Eye::Right);
|
||||
glm::vec3 leftEyeHeadLocal = glm::vec3(leftEye[3]);
|
||||
glm::vec3 rightEyeHeadLocal = glm::vec3(rightEye[3]);
|
||||
auto humanSystem = Application::getInstance()->getViewFrustum();
|
||||
auto humanSystem = qApp->getViewFrustum();
|
||||
glm::vec3 humanLeftEye = humanSystem->getPosition() + (humanSystem->getOrientation() * leftEyeHeadLocal);
|
||||
glm::vec3 humanRightEye = humanSystem->getPosition() + (humanSystem->getOrientation() * rightEyeHeadLocal);
|
||||
|
||||
|
@ -1065,7 +1065,7 @@ void MyAvatar::updateLookAtTargetAvatar() {
|
|||
*/
|
||||
|
||||
// And now we can finally add that offset to the camera.
|
||||
glm::vec3 corrected = Application::getInstance()->getViewFrustum()->getPosition() + gazeOffset;
|
||||
glm::vec3 corrected = qApp->getViewFrustum()->getPosition() + gazeOffset;
|
||||
|
||||
avatar->getHead()->setCorrectedLookAtPosition(corrected);
|
||||
|
||||
|
@ -1172,7 +1172,7 @@ void MyAvatar::clearJointAnimationPriorities() {
|
|||
void MyAvatar::setFaceModelURL(const QUrl& faceModelURL) {
|
||||
|
||||
Avatar::setFaceModelURL(faceModelURL);
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
getHead()->getFaceModel().setVisibleInScene(_prevShouldDrawHead, scene);
|
||||
_billboardValid = false;
|
||||
}
|
||||
|
@ -1180,7 +1180,7 @@ void MyAvatar::setFaceModelURL(const QUrl& faceModelURL) {
|
|||
void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) {
|
||||
|
||||
Avatar::setSkeletonModelURL(skeletonModelURL);
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
_billboardValid = false;
|
||||
_skeletonModel.setVisibleInScene(true, scene);
|
||||
_headBoneSet.clear();
|
||||
|
@ -1238,7 +1238,7 @@ void MyAvatar::setAttachmentData(const QVector<AttachmentData>& attachmentData)
|
|||
}
|
||||
|
||||
glm::vec3 MyAvatar::getSkeletonPosition() const {
|
||||
CameraMode mode = Application::getInstance()->getCamera()->getMode();
|
||||
CameraMode mode = qApp->getCamera()->getMode();
|
||||
if (mode == CAMERA_MODE_THIRD_PERSON || mode == CAMERA_MODE_INDEPENDENT) {
|
||||
// The avatar is rotated PI about the yAxis, so we have to correct for it
|
||||
// to get the skeleton offset contribution in the world-frame.
|
||||
|
@ -1339,13 +1339,13 @@ void MyAvatar::renderBody(RenderArgs* renderArgs, ViewFrustum* renderFrustum, fl
|
|||
|
||||
// This is drawing the lookat vectors from our avatar to wherever we're looking.
|
||||
if (qApp->isHMDMode()) {
|
||||
glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
||||
glm::vec3 cameraPosition = qApp->getCamera()->getPosition();
|
||||
|
||||
glm::mat4 leftEyePose = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Left);
|
||||
glm::mat4 leftEyePose = qApp->getActiveDisplayPlugin()->getEyePose(Eye::Left);
|
||||
glm::vec3 leftEyePosition = glm::vec3(leftEyePose[3]);
|
||||
glm::mat4 rightEyePose = Application::getInstance()->getActiveDisplayPlugin()->getEyePose(Eye::Right);
|
||||
glm::mat4 rightEyePose = qApp->getActiveDisplayPlugin()->getEyePose(Eye::Right);
|
||||
glm::vec3 rightEyePosition = glm::vec3(rightEyePose[3]);
|
||||
glm::mat4 headPose = Application::getInstance()->getActiveDisplayPlugin()->getHeadPose();
|
||||
glm::mat4 headPose = qApp->getActiveDisplayPlugin()->getHeadPose();
|
||||
glm::vec3 headPosition = glm::vec3(headPose[3]);
|
||||
|
||||
getHead()->renderLookAts(renderArgs,
|
||||
|
@ -1421,7 +1421,7 @@ void MyAvatar::destroyAnimGraph() {
|
|||
|
||||
void MyAvatar::preRender(RenderArgs* renderArgs) {
|
||||
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
const bool shouldDrawHead = shouldRenderHead(renderArgs);
|
||||
|
||||
if (_skeletonModel.initWhenReady(scene)) {
|
||||
|
@ -1476,13 +1476,13 @@ const float RENDER_HEAD_CUTOFF_DISTANCE = 0.50f;
|
|||
|
||||
bool MyAvatar::cameraInsideHead() const {
|
||||
const Head* head = getHead();
|
||||
const glm::vec3 cameraPosition = Application::getInstance()->getCamera()->getPosition();
|
||||
const glm::vec3 cameraPosition = qApp->getCamera()->getPosition();
|
||||
return glm::length(cameraPosition - head->getEyePosition()) < (RENDER_HEAD_CUTOFF_DISTANCE * _scale);
|
||||
}
|
||||
|
||||
bool MyAvatar::shouldRenderHead(const RenderArgs* renderArgs) const {
|
||||
return ((renderArgs->_renderMode != RenderArgs::DEFAULT_RENDER_MODE) ||
|
||||
(Application::getInstance()->getCamera()->getMode() != CAMERA_MODE_FIRST_PERSON) ||
|
||||
(qApp->getCamera()->getMode() != CAMERA_MODE_FIRST_PERSON) ||
|
||||
!cameraInsideHead());
|
||||
}
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
glm::vec3 euler = glm::eulerAngles(localOrientation) * DEGREES_PER_RADIAN;
|
||||
|
||||
//Invert yaw and roll when in mirror mode
|
||||
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
if (qApp->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||
YAW(euler) *= -1.0f;
|
||||
ROLL(euler) *= -1.0f;
|
||||
}
|
||||
|
@ -1951,7 +1951,7 @@ glm::vec3 MyAvatar::getPositionForAudio() {
|
|||
case AudioListenerMode::FROM_HEAD:
|
||||
return getHead()->getPosition();
|
||||
case AudioListenerMode::FROM_CAMERA:
|
||||
return Application::getInstance()->getCamera()->getPosition();
|
||||
return qApp->getCamera()->getPosition();
|
||||
case AudioListenerMode::CUSTOM:
|
||||
return _customListenPosition;
|
||||
}
|
||||
|
@ -1963,7 +1963,7 @@ glm::quat MyAvatar::getOrientationForAudio() {
|
|||
case AudioListenerMode::FROM_HEAD:
|
||||
return getHead()->getFinalOrientationInWorldFrame();
|
||||
case AudioListenerMode::FROM_CAMERA:
|
||||
return Application::getInstance()->getCamera()->getOrientation();
|
||||
return qApp->getCamera()->getOrientation();
|
||||
case AudioListenerMode::CUSTOM:
|
||||
return _customListenOrientation;
|
||||
}
|
||||
|
|
|
@ -250,7 +250,7 @@ void RealSense::update() {
|
|||
|
||||
void RealSense::loadRSSDKFile() {
|
||||
QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
|
||||
QString fileNameString = QFileDialog::getOpenFileName(Application::getInstance()->getWindow(), tr("Open RSSDK clip"),
|
||||
QString fileNameString = QFileDialog::getOpenFileName(qApp->getWindow(), tr("Open RSSDK clip"),
|
||||
locationDir,
|
||||
tr("RSSDK Recordings (*.rssdk)"));
|
||||
if (!fileNameString.isEmpty()) {
|
||||
|
|
|
@ -33,11 +33,11 @@ void OctreePacketProcessor::processPacket(QSharedPointer<NLPacket> packet, Share
|
|||
|
||||
const int WAY_BEHIND = 300;
|
||||
|
||||
if (packetsToProcessCount() > WAY_BEHIND && Application::getInstance()->getLogger()->extraDebugging()) {
|
||||
if (packetsToProcessCount() > WAY_BEHIND && qApp->getLogger()->extraDebugging()) {
|
||||
qDebug("OctreePacketProcessor::processPacket() packets to process=%d", packetsToProcessCount());
|
||||
}
|
||||
|
||||
Application* app = Application::getInstance();
|
||||
Application* app = qApp;
|
||||
bool wasStatsPacket = false;
|
||||
|
||||
PacketType octreePacketType = packet->getType();
|
||||
|
|
|
@ -15,12 +15,12 @@ ClipboardScriptingInterface::ClipboardScriptingInterface() {
|
|||
}
|
||||
|
||||
float ClipboardScriptingInterface::getClipboardContentsLargestDimension() {
|
||||
return Application::getInstance()->getEntityClipboard()->getContentsLargestDimension();
|
||||
return qApp->getEntityClipboard()->getContentsLargestDimension();
|
||||
}
|
||||
|
||||
bool ClipboardScriptingInterface::exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs) {
|
||||
bool retVal;
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "exportEntities", Qt::BlockingQueuedConnection,
|
||||
QMetaObject::invokeMethod(qApp, "exportEntities", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, retVal),
|
||||
Q_ARG(const QString&, filename),
|
||||
Q_ARG(const QVector<EntityItemID>&, entityIDs));
|
||||
|
@ -29,7 +29,7 @@ bool ClipboardScriptingInterface::exportEntities(const QString& filename, const
|
|||
|
||||
bool ClipboardScriptingInterface::exportEntities(const QString& filename, float x, float y, float z, float s) {
|
||||
bool retVal;
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "exportEntities", Qt::BlockingQueuedConnection,
|
||||
QMetaObject::invokeMethod(qApp, "exportEntities", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, retVal),
|
||||
Q_ARG(const QString&, filename),
|
||||
Q_ARG(float, x),
|
||||
|
@ -41,7 +41,7 @@ bool ClipboardScriptingInterface::exportEntities(const QString& filename, float
|
|||
|
||||
bool ClipboardScriptingInterface::importEntities(const QString& filename) {
|
||||
bool retVal;
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "importEntities", Qt::BlockingQueuedConnection,
|
||||
QMetaObject::invokeMethod(qApp, "importEntities", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, retVal),
|
||||
Q_ARG(const QString&, filename));
|
||||
return retVal;
|
||||
|
@ -49,7 +49,7 @@ bool ClipboardScriptingInterface::importEntities(const QString& filename) {
|
|||
|
||||
QVector<EntityItemID> ClipboardScriptingInterface::pasteEntities(glm::vec3 position) {
|
||||
QVector<EntityItemID> retVal;
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "pasteEntities", Qt::BlockingQueuedConnection,
|
||||
QMetaObject::invokeMethod(qApp, "pasteEntities", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QVector<EntityItemID>, retVal),
|
||||
Q_ARG(float, position.x),
|
||||
Q_ARG(float, position.y),
|
||||
|
|
|
@ -378,7 +378,7 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) {
|
|||
}
|
||||
|
||||
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
|
||||
return Application::getInstance()->getUiSize();
|
||||
return qApp->getUiSize();
|
||||
}
|
||||
|
||||
AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
#include "MainWindow.h"
|
||||
|
||||
int DesktopScriptingInterface::getWidth() {
|
||||
QSize size = Application::getInstance()->getWindow()->windowHandle()->screen()->virtualSize();
|
||||
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
||||
return size.width();
|
||||
}
|
||||
int DesktopScriptingInterface::getHeight() {
|
||||
QSize size = Application::getInstance()->getWindow()->windowHandle()->screen()->virtualSize();
|
||||
QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize();
|
||||
return size.height();
|
||||
}
|
||||
|
|
|
@ -143,5 +143,5 @@ void GlobalServicesScriptingInterface::updateDownloadInfo() {
|
|||
}
|
||||
|
||||
void GlobalServicesScriptingInterface::editFriends() {
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "showFriendsWindow");
|
||||
QMetaObject::invokeMethod(qApp, "showFriendsWindow");
|
||||
}
|
||||
|
|
|
@ -10,22 +10,27 @@
|
|||
//
|
||||
|
||||
#include "HMDScriptingInterface.h"
|
||||
#include "display-plugins/DisplayPlugin.h"
|
||||
|
||||
#include <QtScript/QScriptContext>
|
||||
|
||||
#include <avatar/AvatarManager.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "display-plugins/DisplayPlugin.h"
|
||||
|
||||
HMDScriptingInterface& HMDScriptingInterface::getInstance() {
|
||||
static HMDScriptingInterface sharedInstance;
|
||||
return sharedInstance;
|
||||
}
|
||||
|
||||
bool HMDScriptingInterface::getHUDLookAtPosition3D(glm::vec3& result) const {
|
||||
Camera* camera = Application::getInstance()->getCamera();
|
||||
Camera* camera = qApp->getCamera();
|
||||
glm::vec3 position = camera->getPosition();
|
||||
glm::quat orientation = camera->getOrientation();
|
||||
|
||||
glm::vec3 direction = orientation * glm::vec3(0.0f, 0.0f, -1.0f);
|
||||
|
||||
const auto& compositor = Application::getInstance()->getApplicationCompositor();
|
||||
const auto& compositor = qApp->getApplicationCompositor();
|
||||
|
||||
return compositor.calculateRayUICollisionPoint(position, direction, result);
|
||||
}
|
||||
|
@ -40,7 +45,7 @@ QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* conte
|
|||
glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * (hudIntersection - sphereCenter);
|
||||
glm::quat rotation = ::rotationBetween(glm::vec3(0.0f, 0.0f, -1.0f), direction);
|
||||
glm::vec3 eulers = ::safeEulerAngles(rotation);
|
||||
return qScriptValueFromValue<glm::vec2>(engine, Application::getInstance()->getApplicationCompositor()
|
||||
return qScriptValueFromValue<glm::vec2>(engine, qApp->getApplicationCompositor()
|
||||
.sphericalToOverlay(glm::vec2(eulers.y, -eulers.x)));
|
||||
}
|
||||
return QScriptValue::NullValue;
|
||||
|
@ -55,5 +60,13 @@ QScriptValue HMDScriptingInterface::getHUDLookAtPosition3D(QScriptContext* conte
|
|||
}
|
||||
|
||||
float HMDScriptingInterface::getIPD() const {
|
||||
return Application::getInstance()->getActiveDisplayPlugin()->getIPD();
|
||||
return qApp->getActiveDisplayPlugin()->getIPD();
|
||||
}
|
||||
|
||||
void HMDScriptingInterface::toggleMagnifier() {
|
||||
qApp->getApplicationCompositor().toggleMagnifier();
|
||||
}
|
||||
|
||||
bool HMDScriptingInterface::getMagnifier() const {
|
||||
return qApp->getApplicationCompositor().hasMagnifier();
|
||||
}
|
||||
|
|
|
@ -12,32 +12,36 @@
|
|||
#ifndef hifi_HMDScriptingInterface_h
|
||||
#define hifi_HMDScriptingInterface_h
|
||||
|
||||
#include <QtScript/QScriptValue>
|
||||
|
||||
#include <GLMHelpers.h>
|
||||
|
||||
#include "Application.h"
|
||||
class QScriptContext;
|
||||
class QScriptEngine;
|
||||
|
||||
|
||||
class HMDScriptingInterface : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool magnifier READ getMagnifier)
|
||||
Q_PROPERTY(bool active READ isHMDMode)
|
||||
Q_PROPERTY(float ipd READ getIPD)
|
||||
|
||||
public:
|
||||
static HMDScriptingInterface& getInstance();
|
||||
|
||||
|
||||
static QScriptValue getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine);
|
||||
static QScriptValue getHUDLookAtPosition3D(QScriptContext* context, QScriptEngine* engine);
|
||||
|
||||
public slots:
|
||||
void toggleMagnifier() { Application::getInstance()->getApplicationCompositor().toggleMagnifier(); };
|
||||
void toggleMagnifier();
|
||||
|
||||
private:
|
||||
HMDScriptingInterface() {};
|
||||
bool getMagnifier() const { return Application::getInstance()->getApplicationCompositor().hasMagnifier(); };
|
||||
bool isHMDMode() const { return Application::getInstance()->isHMDMode(); }
|
||||
HMDScriptingInterface() = default;
|
||||
bool getMagnifier() const;
|
||||
bool isHMDMode() const;
|
||||
float getIPD() const;
|
||||
|
||||
bool getHUDLookAtPosition3D(glm::vec3& result) const;
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_HMDScriptingInterface_h
|
||||
|
|
|
@ -41,7 +41,7 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
|||
_isToolWindow(isToolWindow) {
|
||||
|
||||
if (_isToolWindow) {
|
||||
ToolWindow* toolWindow = Application::getInstance()->getToolWindow();
|
||||
ToolWindow* toolWindow = qApp->getToolWindow();
|
||||
|
||||
auto dockWidget = new QDockWidget(title, toolWindow);
|
||||
dockWidget->setFeatures(QDockWidget::DockWidgetMovable);
|
||||
|
@ -56,7 +56,7 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
|||
|
||||
_windowWidget = dockWidget;
|
||||
} else {
|
||||
auto dialogWidget = new QDialog(Application::getInstance()->getWindow(), Qt::Window);
|
||||
auto dialogWidget = new QDialog(qApp->getWindow(), Qt::Window);
|
||||
dialogWidget->setWindowTitle(title);
|
||||
dialogWidget->resize(width, height);
|
||||
dialogWidget->installEventFilter(this);
|
||||
|
@ -120,7 +120,7 @@ void WebWindowClass::setVisible(bool visible) {
|
|||
if (visible) {
|
||||
if (_isToolWindow) {
|
||||
QMetaObject::invokeMethod(
|
||||
Application::getInstance()->getToolWindow(), "setVisible", Qt::AutoConnection, Q_ARG(bool, visible));
|
||||
qApp->getToolWindow(), "setVisible", Qt::AutoConnection, Q_ARG(bool, visible));
|
||||
} else {
|
||||
QMetaObject::invokeMethod(_windowWidget, "showNormal", Qt::AutoConnection);
|
||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::AutoConnection);
|
||||
|
|
|
@ -32,8 +32,8 @@ WindowScriptingInterface::WindowScriptingInterface() :
|
|||
{
|
||||
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
||||
connect(&domainHandler, &DomainHandler::connectedToDomain, this, &WindowScriptingInterface::domainChanged);
|
||||
connect(Application::getInstance(), &Application::svoImportRequested, this, &WindowScriptingInterface::svoImportRequested);
|
||||
connect(Application::getInstance(), &Application::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused);
|
||||
connect(qApp, &Application::svoImportRequested, this, &WindowScriptingInterface::svoImportRequested);
|
||||
connect(qApp, &Application::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused);
|
||||
}
|
||||
|
||||
WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height, bool isToolWindow) {
|
||||
|
@ -41,13 +41,13 @@ WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title
|
|||
}
|
||||
|
||||
QScriptValue WindowScriptingInterface::hasFocus() {
|
||||
return Application::getInstance()->hasFocus();
|
||||
return qApp->hasFocus();
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::setFocus() {
|
||||
// It's forbidden to call focus() from another thread.
|
||||
Application::getInstance()->postLambdaEvent([] {
|
||||
auto window = Application::getInstance()->getWindow();
|
||||
qApp->postLambdaEvent([] {
|
||||
auto window = qApp->getWindow();
|
||||
window->activateWindow();
|
||||
window->setFocus();
|
||||
});
|
||||
|
@ -55,18 +55,18 @@ void WindowScriptingInterface::setFocus() {
|
|||
|
||||
void WindowScriptingInterface::raiseMainWindow() {
|
||||
// It's forbidden to call raise() from another thread.
|
||||
Application::getInstance()->postLambdaEvent([] {
|
||||
Application::getInstance()->getWindow()->raise();
|
||||
qApp->postLambdaEvent([] {
|
||||
qApp->getWindow()->raise();
|
||||
});
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::setCursorVisible(bool visible) {
|
||||
QMetaObject::invokeMethod(Application::getInstance(), "setCursorVisible", Qt::BlockingQueuedConnection,
|
||||
QMetaObject::invokeMethod(qApp, "setCursorVisible", Qt::BlockingQueuedConnection,
|
||||
Q_ARG(bool, visible));
|
||||
}
|
||||
|
||||
bool WindowScriptingInterface::isCursorVisible() const {
|
||||
return !Application::getInstance()->isMouseHidden();
|
||||
return !qApp->isMouseHidden();
|
||||
}
|
||||
|
||||
void WindowScriptingInterface::setCursorPosition(int x, int y) {
|
||||
|
@ -167,7 +167,7 @@ QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue fo
|
|||
/// \param const QString& message message to display
|
||||
/// \return QScriptValue::UndefinedValue
|
||||
QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
||||
QMessageBox::warning(Application::getInstance()->getWindow(), "", message);
|
||||
QMessageBox::warning(qApp->getWindow(), "", message);
|
||||
return QScriptValue::UndefinedValue;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
|||
/// \param const QString& message message to display
|
||||
/// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise
|
||||
QScriptValue WindowScriptingInterface::showConfirm(const QString& message) {
|
||||
QMessageBox::StandardButton response = QMessageBox::question(Application::getInstance()->getWindow(), "", message);
|
||||
QMessageBox::StandardButton response = QMessageBox::question(qApp->getWindow(), "", message);
|
||||
return QScriptValue(response == QMessageBox::Yes);
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ QScriptValue WindowScriptingInterface::showForm(const QString& title, QScriptVal
|
|||
|
||||
|
||||
QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue form) {
|
||||
QDialog* editDialog = new QDialog(Application::getInstance()->getWindow());
|
||||
QDialog* editDialog = new QDialog(qApp->getWindow());
|
||||
editDialog->setWindowTitle(title);
|
||||
|
||||
bool cancelButton = false;
|
||||
|
@ -597,7 +597,7 @@ QDialog* WindowScriptingInterface::createForm(const QString& title, QScriptValue
|
|||
/// \param const QString& defaultText default text in the text box
|
||||
/// \return QScriptValue string text value in text box if the dialog was accepted, `null` otherwise.
|
||||
QScriptValue WindowScriptingInterface::showPrompt(const QString& message, const QString& defaultText) {
|
||||
QInputDialog promptDialog(Application::getInstance()->getWindow());
|
||||
QInputDialog promptDialog(qApp->getWindow());
|
||||
promptDialog.setWindowTitle("");
|
||||
promptDialog.setLabelText(message);
|
||||
promptDialog.setTextValue(defaultText);
|
||||
|
@ -627,7 +627,7 @@ QScriptValue WindowScriptingInterface::showBrowse(const QString& title, const QS
|
|||
path = fileInfo.filePath();
|
||||
}
|
||||
|
||||
QFileDialog fileDialog(Application::getInstance()->getWindow(), title, path, nameFilter);
|
||||
QFileDialog fileDialog(qApp->getWindow(), title, path, nameFilter);
|
||||
fileDialog.setAcceptMode(acceptMode);
|
||||
QUrl fileUrl(directory);
|
||||
if (acceptMode == QFileDialog::AcceptSave) {
|
||||
|
@ -657,17 +657,17 @@ QScriptValue WindowScriptingInterface::showS3Browse(const QString& nameFilter) {
|
|||
}
|
||||
|
||||
int WindowScriptingInterface::getInnerWidth() {
|
||||
return Application::getInstance()->getWindow()->geometry().width();
|
||||
return qApp->getWindow()->geometry().width();
|
||||
}
|
||||
|
||||
int WindowScriptingInterface::getInnerHeight() {
|
||||
return Application::getInstance()->getWindow()->geometry().height();
|
||||
return qApp->getWindow()->geometry().height();
|
||||
}
|
||||
|
||||
int WindowScriptingInterface::getX() {
|
||||
return Application::getInstance()->getWindow()->x();
|
||||
return qApp->getWindow()->x();
|
||||
}
|
||||
|
||||
int WindowScriptingInterface::getY() {
|
||||
return Application::getInstance()->getWindow()->y();
|
||||
return qApp->getWindow()->y();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void AvatarInputs::update() {
|
|||
}
|
||||
|
||||
void AvatarInputs::toggleCameraMute() {
|
||||
FaceTracker* faceTracker = Application::getInstance()->getSelectedFaceTracker();
|
||||
FaceTracker* faceTracker = qApp->getSelectedFaceTracker();
|
||||
if (faceTracker) {
|
||||
faceTracker->toggleMute();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ ChatMessageArea::ChatMessageArea(bool useFixedHeight) : QTextBrowser(), _useFixe
|
|||
connect(document()->documentLayout(), &QAbstractTextDocumentLayout::documentSizeChanged,
|
||||
this, &ChatMessageArea::updateLayout);
|
||||
|
||||
connect(this, &QTextBrowser::anchorClicked, Application::getInstance(), &Application::openUrl);
|
||||
connect(this, &QTextBrowser::anchorClicked, qApp, &Application::openUrl);
|
||||
}
|
||||
|
||||
void ChatMessageArea::setHtml(const QString& html) {
|
||||
|
|
|
@ -28,7 +28,7 @@ DataWebDialog::DataWebDialog() {
|
|||
setPage(new DataWebPage(this));
|
||||
|
||||
// have the Application handle external links
|
||||
connect(this, &QWebView::linkClicked, Application::getInstance(), &Application::openUrl);
|
||||
connect(this, &QWebView::linkClicked, qApp, &Application::openUrl);
|
||||
}
|
||||
|
||||
DataWebDialog* DataWebDialog::dialogForPath(const QString& path,
|
||||
|
|
|
@ -34,15 +34,15 @@ void DataWebPage::javaScriptConsoleMessage(const QString& message, int lineNumbe
|
|||
bool DataWebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type) {
|
||||
// Handle hifi:// links and links to files with particular extensions
|
||||
QString urlString = request.url().toString();
|
||||
if (Application::getInstance()->canAcceptURL(urlString)) {
|
||||
if (Application::getInstance()->acceptURL(urlString)) {
|
||||
if (qApp->canAcceptURL(urlString)) {
|
||||
if (qApp->acceptURL(urlString)) {
|
||||
return false; // we handled it, so QWebPage doesn't need to handle it
|
||||
}
|
||||
}
|
||||
|
||||
// Make hyperlinks with target="_blank" open in user's Web browser
|
||||
if (type == QWebPage::NavigationTypeLinkClicked && frame == nullptr) {
|
||||
Application::getInstance()->openUrl(request.url());
|
||||
qApp->openUrl(request.url());
|
||||
return false; // We handled it.
|
||||
}
|
||||
|
||||
|
|
|
@ -78,11 +78,11 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) :
|
|||
// what screens we're allowed on
|
||||
watchWindow(windowHandle());
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
if (Application::getInstance()->getRunningScriptsWidget()) {
|
||||
watchWindow(Application::getInstance()->getRunningScriptsWidget()->windowHandle());
|
||||
if (qApp->getRunningScriptsWidget()) {
|
||||
watchWindow(qApp->getRunningScriptsWidget()->windowHandle());
|
||||
}
|
||||
if (Application::getInstance()->getToolWindow()) {
|
||||
watchWindow(Application::getInstance()->getToolWindow()->windowHandle());
|
||||
if (qApp->getToolWindow()) {
|
||||
watchWindow(qApp->getToolWindow()->windowHandle());
|
||||
}
|
||||
if (dialogsManager->getBandwidthDialog()) {
|
||||
watchWindow(dialogsManager->getBandwidthDialog()->windowHandle());
|
||||
|
@ -110,7 +110,7 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) :
|
|||
});
|
||||
|
||||
// watch for our application window moving screens. If it does we want to update our screen details
|
||||
QWindow* mainWindow = Application::getInstance()->getWindow()->windowHandle();
|
||||
QWindow* mainWindow = qApp->getWindow()->windowHandle();
|
||||
connect(mainWindow, &QWindow::screenChanged, [this]{
|
||||
updateUi();
|
||||
});
|
||||
|
@ -142,7 +142,7 @@ QString HMDToolsDialog::getDebugDetails() const {
|
|||
results += "Desktop's Primary Screen: " + desktopPrimaryScreen->name() + "\n";
|
||||
|
||||
results += "Application Primary Screen: " + QGuiApplication::primaryScreen()->name() + "\n";
|
||||
QScreen* mainWindowScreen = Application::getInstance()->getWindow()->windowHandle()->screen();
|
||||
QScreen* mainWindowScreen = qApp->getWindow()->windowHandle()->screen();
|
||||
results += "Application Main Window Screen: " + mainWindowScreen->name() + "\n";
|
||||
results += "Total Screens: " + QString::number(QApplication::desktop()->screenCount()) + "\n";
|
||||
|
||||
|
@ -159,15 +159,15 @@ void HMDToolsDialog::toggleHMDMode() {
|
|||
|
||||
void HMDToolsDialog::enterHMDMode() {
|
||||
if (!qApp->isHMDMode()) {
|
||||
Application::getInstance()->setActiveDisplayPlugin(_hmdPluginName);
|
||||
Application::getInstance()->getWindow()->activateWindow();
|
||||
qApp->setActiveDisplayPlugin(_hmdPluginName);
|
||||
qApp->getWindow()->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void HMDToolsDialog::leaveHMDMode() {
|
||||
if (qApp->isHMDMode()) {
|
||||
Application::getInstance()->setActiveDisplayPlugin(_defaultPluginName);
|
||||
Application::getInstance()->getWindow()->activateWindow();
|
||||
qApp->setActiveDisplayPlugin(_defaultPluginName);
|
||||
qApp->getWindow()->activateWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ void HMDToolsDialog::showEvent(QShowEvent* event) {
|
|||
|
||||
void HMDToolsDialog::hideEvent(QHideEvent* event) {
|
||||
// center the cursor on the main application window
|
||||
centerCursorOnWidget(Application::getInstance()->getWindow());
|
||||
centerCursorOnWidget(qApp->getWindow());
|
||||
}
|
||||
|
||||
void HMDToolsDialog::screenCountChanged(int newCount) {
|
||||
|
@ -275,7 +275,7 @@ void HMDWindowWatcher::windowScreenChanged(QScreen* screen) {
|
|||
QScreen* betterScreen = NULL;
|
||||
|
||||
QScreen* lastApplicationScreen = _hmdTools->getLastApplicationScreen();
|
||||
QWindow* appWindow = Application::getInstance()->getWindow()->windowHandle();
|
||||
QWindow* appWindow = qApp->getWindow()->windowHandle();
|
||||
QScreen* appScreen = appWindow->screen();
|
||||
|
||||
if (_previousScreen && _previousScreen != hmdScreen) {
|
||||
|
|
|
@ -53,7 +53,7 @@ JSConsole::JSConsole(QWidget* parent, ScriptEngine* scriptEngine) :
|
|||
|
||||
|
||||
if (_scriptEngine == NULL) {
|
||||
_scriptEngine = Application::getInstance()->loadScript(QString(), false);
|
||||
_scriptEngine = qApp->loadScript(QString(), false);
|
||||
}
|
||||
|
||||
connect(_scriptEngine, SIGNAL(evaluationFinished(QScriptValue, bool)),
|
||||
|
|
|
@ -20,8 +20,8 @@ MarketplaceDialog::MarketplaceDialog(QQuickItem* parent) : OffscreenQmlDialog(pa
|
|||
|
||||
bool MarketplaceDialog::navigationRequested(const QString& url) {
|
||||
qDebug() << url;
|
||||
if (Application::getInstance()->canAcceptURL(url)) {
|
||||
if (Application::getInstance()->acceptURL(url)) {
|
||||
if (qApp->canAcceptURL(url)) {
|
||||
if (qApp->acceptURL(url)) {
|
||||
return false; // we handled it, so QWebPage doesn't need to handle it
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ OctreeStatsDialog::~OctreeStatsDialog() {
|
|||
void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
|
||||
|
||||
// Processed Entities Related stats
|
||||
auto entities = Application::getInstance()->getEntities();
|
||||
auto entities = qApp->getEntities();
|
||||
auto entitiesTree = entities->getTree();
|
||||
|
||||
// Do this ever paint event... even if we don't update
|
||||
|
@ -196,7 +196,7 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
|
|||
unsigned long totalInternal = 0;
|
||||
unsigned long totalLeaves = 0;
|
||||
|
||||
NodeToOctreeSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats();
|
||||
NodeToOctreeSceneStats* sceneStats = qApp->getOcteeSceneStats();
|
||||
sceneStats->withReadLock([&] {
|
||||
for (NodeToOctreeSceneStatsIterator i = sceneStats->begin(); i != sceneStats->end(); i++) {
|
||||
//const QUuid& uuid = i->first;
|
||||
|
@ -264,7 +264,7 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
|
|||
QString averageReadBitstreamPerPacketString = locale.toString(averageReadBitstreamPerPacket);
|
||||
|
||||
label = _labels[_processedPackets];
|
||||
const OctreePacketProcessor& entitiesPacketProcessor = Application::getInstance()->getOctreePacketProcessor();
|
||||
const OctreePacketProcessor& entitiesPacketProcessor = qApp->getOctreePacketProcessor();
|
||||
|
||||
auto incomingPPS = entitiesPacketProcessor.getIncomingPPS();
|
||||
auto processedPPS = entitiesPacketProcessor.getProcessedPPS();
|
||||
|
@ -351,7 +351,7 @@ void OctreeStatsDialog::showAllOctreeServers() {
|
|||
int serverCount = 0;
|
||||
|
||||
showOctreeServersOfType(serverCount, NodeType::EntityServer, "Entity",
|
||||
Application::getInstance()->getEntityServerJurisdictions());
|
||||
qApp->getEntityServerJurisdictions());
|
||||
|
||||
if (_octreeServerLabelsCount > serverCount) {
|
||||
for (int i = serverCount; i < _octreeServerLabelsCount; i++) {
|
||||
|
@ -427,7 +427,7 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser
|
|||
|
||||
// now lookup stats details for this server...
|
||||
if (_extraServerDetails[serverCount-1] != LESS) {
|
||||
NodeToOctreeSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats();
|
||||
NodeToOctreeSceneStats* sceneStats = qApp->getOcteeSceneStats();
|
||||
sceneStats->withReadLock([&] {
|
||||
if (sceneStats->find(nodeUUID) != sceneStats->end()) {
|
||||
OctreeSceneStats& stats = sceneStats->at(nodeUUID);
|
||||
|
|
|
@ -45,14 +45,14 @@ PreferencesDialog::PreferencesDialog(QWidget* parent) :
|
|||
|
||||
connect(ui.buttonBrowseLocation, &QPushButton::clicked, this, &PreferencesDialog::openSnapshotLocationBrowser);
|
||||
connect(ui.buttonBrowseScriptsLocation, &QPushButton::clicked, this, &PreferencesDialog::openScriptsLocationBrowser);
|
||||
connect(ui.buttonReloadDefaultScripts, &QPushButton::clicked, Application::getInstance(), &Application::loadDefaultScripts);
|
||||
connect(ui.buttonReloadDefaultScripts, &QPushButton::clicked, qApp, &Application::loadDefaultScripts);
|
||||
|
||||
connect(ui.buttonChangeAppearance, &QPushButton::clicked, this, &PreferencesDialog::openFullAvatarModelBrowser);
|
||||
connect(ui.appearanceDescription, &QLineEdit::textChanged, this, [this](const QString& url) {
|
||||
DependencyManager::get<AvatarManager>()->getMyAvatar()->useFullAvatarURL(url, "");
|
||||
this->fullAvatarURLChanged(url, "");
|
||||
});
|
||||
connect(Application::getInstance(), &Application::fullAvatarURLChanged, this, &PreferencesDialog::fullAvatarURLChanged);
|
||||
connect(qApp, &Application::fullAvatarURLChanged, this, &PreferencesDialog::fullAvatarURLChanged);
|
||||
|
||||
// move dialog to left side
|
||||
move(parentWidget()->geometry().topLeft());
|
||||
|
@ -298,7 +298,7 @@ void PreferencesDialog::savePreferences() {
|
|||
audio->setOutputStarveDetectionThreshold(ui.outputStarveDetectionThresholdSpinner->value());
|
||||
audio->setOutputStarveDetectionPeriod(ui.outputStarveDetectionPeriodSpinner->value());
|
||||
|
||||
Application::getInstance()->resizeGL();
|
||||
qApp->resizeGL();
|
||||
|
||||
// LOD items
|
||||
auto lodManager = DependencyManager::get<LODManager>();
|
||||
|
|
|
@ -57,15 +57,15 @@ RunningScriptsWidget::RunningScriptsWidget(QWidget* parent) :
|
|||
connect(ui->filterLineEdit, &QLineEdit::textChanged, this, &RunningScriptsWidget::updateFileFilter);
|
||||
connect(ui->scriptTreeView, &QTreeView::doubleClicked, this, &RunningScriptsWidget::loadScriptFromList);
|
||||
|
||||
connect(ui->reloadAllButton, &QPushButton::clicked, Application::getInstance(), &Application::reloadAllScripts);
|
||||
connect(ui->reloadAllButton, &QPushButton::clicked, qApp, &Application::reloadAllScripts);
|
||||
connect(ui->stopAllButton, &QPushButton::clicked, this, &RunningScriptsWidget::allScriptsStopped);
|
||||
connect(ui->loadScriptFromDiskButton, &QPushButton::clicked, Application::getInstance(), &Application::loadDialog);
|
||||
connect(ui->loadScriptFromURLButton, &QPushButton::clicked, Application::getInstance(), &Application::loadScriptURLDialog);
|
||||
connect(ui->loadScriptFromDiskButton, &QPushButton::clicked, qApp, &Application::loadDialog);
|
||||
connect(ui->loadScriptFromURLButton, &QPushButton::clicked, qApp, &Application::loadScriptURLDialog);
|
||||
connect(&_reloadSignalMapper, static_cast<void(QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped),
|
||||
Application::getInstance(), &Application::reloadOneScript);
|
||||
qApp, &Application::reloadOneScript);
|
||||
|
||||
connect(&_stopSignalMapper, static_cast<void(QSignalMapper::*)(const QString&)>(&QSignalMapper::mapped),
|
||||
[](const QString& script) { Application::getInstance()->stopScript(script); });
|
||||
[](const QString& script) { qApp->stopScript(script); });
|
||||
|
||||
UIUtil::scaleWidgetFontSizes(this);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void RunningScriptsWidget::updateFileFilter(const QString& filter) {
|
|||
|
||||
void RunningScriptsWidget::loadScriptFromList(const QModelIndex& index) {
|
||||
QVariant scriptFile = _scriptsModelFilter.data(index, ScriptsModel::ScriptPath);
|
||||
Application::getInstance()->loadScript(scriptFile.toString());
|
||||
qApp->loadScript(scriptFile.toString());
|
||||
}
|
||||
|
||||
void RunningScriptsWidget::loadSelectedScript() {
|
||||
|
@ -172,7 +172,7 @@ void RunningScriptsWidget::showEvent(QShowEvent* event) {
|
|||
ui->filterLineEdit->setFocus();
|
||||
}
|
||||
|
||||
QRect parentGeometry = Application::getInstance()->getDesirableApplicationGeometry();
|
||||
QRect parentGeometry = qApp->getDesirableApplicationGeometry();
|
||||
int titleBarHeight = UIUtil::getWindowTitleBarHeight(this);
|
||||
int topMargin = titleBarHeight;
|
||||
|
||||
|
@ -217,13 +217,13 @@ void RunningScriptsWidget::keyPressEvent(QKeyEvent *keyEvent) {
|
|||
}
|
||||
|
||||
void RunningScriptsWidget::allScriptsStopped() {
|
||||
Application::getInstance()->stopAllScripts();
|
||||
qApp->stopAllScripts();
|
||||
}
|
||||
|
||||
QVariantList RunningScriptsWidget::getRunning() {
|
||||
const int WINDOWS_DRIVE_LETTER_SIZE = 1;
|
||||
QVariantList result;
|
||||
foreach(const QString& runningScript, Application::getInstance()->getRunningScripts()) {
|
||||
foreach(const QString& runningScript, qApp->getRunningScripts()) {
|
||||
QUrl runningScriptURL = QUrl(runningScript);
|
||||
if (runningScriptURL.scheme().size() <= WINDOWS_DRIVE_LETTER_SIZE) {
|
||||
runningScriptURL = QUrl::fromLocalFile(runningScriptURL.toDisplayString(QUrl::FormattingOptions(QUrl::FullyEncoded)));
|
||||
|
@ -245,7 +245,7 @@ QVariantList RunningScriptsWidget::getPublic() {
|
|||
|
||||
QVariantList RunningScriptsWidget::getPublicChildNodes(TreeNodeFolder* parent) {
|
||||
QVariantList result;
|
||||
QList<TreeNodeBase*> treeNodes = Application::getInstance()->getRunningScriptsWidget()->getScriptsModel()
|
||||
QList<TreeNodeBase*> treeNodes = qApp->getRunningScriptsWidget()->getScriptsModel()
|
||||
->getFolderNodes(parent);
|
||||
for (int i = 0; i < treeNodes.size(); i++) {
|
||||
TreeNodeBase* node = treeNodes.at(i);
|
||||
|
@ -273,7 +273,7 @@ QVariantList RunningScriptsWidget::getPublicChildNodes(TreeNodeFolder* parent) {
|
|||
|
||||
QVariantList RunningScriptsWidget::getLocal() {
|
||||
QVariantList result;
|
||||
QList<TreeNodeBase*> treeNodes = Application::getInstance()->getRunningScriptsWidget()->getScriptsModel()
|
||||
QList<TreeNodeBase*> treeNodes = qApp->getRunningScriptsWidget()->getScriptsModel()
|
||||
->getFolderNodes(NULL);
|
||||
for (int i = 0; i < treeNodes.size(); i++) {
|
||||
TreeNodeBase* node = treeNodes.at(i);
|
||||
|
@ -293,14 +293,14 @@ QVariantList RunningScriptsWidget::getLocal() {
|
|||
}
|
||||
|
||||
bool RunningScriptsWidget::stopScriptByName(const QString& name) {
|
||||
foreach (const QString& runningScript, Application::getInstance()->getRunningScripts()) {
|
||||
foreach (const QString& runningScript, qApp->getRunningScripts()) {
|
||||
if (QUrl(runningScript).fileName().toLower() == name.trimmed().toLower()) {
|
||||
return Application::getInstance()->stopScript(runningScript, false);
|
||||
return qApp->stopScript(runningScript, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RunningScriptsWidget::stopScript(const QString& name, bool restart) {
|
||||
return Application::getInstance()->stopScript(name, restart);
|
||||
return qApp->stopScript(name, restart);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ bool ScriptEditorWidget::setRunning(bool run) {
|
|||
if (run) {
|
||||
const QString& scriptURLString = QUrl(_currentScript).toString();
|
||||
// Reload script so that an out of date copy is not retrieved from the cache
|
||||
_scriptEngine = Application::getInstance()->loadScript(scriptURLString, true, true, false, true);
|
||||
_scriptEngine = qApp->loadScript(scriptURLString, true, true, false, true);
|
||||
connect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
|
||||
connect(_scriptEngine, &ScriptEngine::errorMessage, this, &ScriptEditorWidget::onScriptError);
|
||||
connect(_scriptEngine, &ScriptEngine::printedMessage, this, &ScriptEditorWidget::onScriptPrint);
|
||||
|
@ -106,7 +106,7 @@ bool ScriptEditorWidget::setRunning(bool run) {
|
|||
connect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
|
||||
} else {
|
||||
connect(_scriptEngine, &ScriptEngine::finished, this, &ScriptEditorWidget::onScriptFinished);
|
||||
Application::getInstance()->stopScript(_currentScript);
|
||||
qApp->stopScript(_currentScript);
|
||||
_scriptEngine = NULL;
|
||||
}
|
||||
return true;
|
||||
|
@ -170,7 +170,7 @@ void ScriptEditorWidget::loadFile(const QString& scriptPath) {
|
|||
}
|
||||
|
||||
const QString& scriptURLString = QUrl(_currentScript).toString();
|
||||
_scriptEngine = Application::getInstance()->getScriptEngine(scriptURLString);
|
||||
_scriptEngine = qApp->getScriptEngine(scriptURLString);
|
||||
if (_scriptEngine != NULL) {
|
||||
connect(_scriptEngine, &ScriptEngine::runningStateChanged, this, &ScriptEditorWidget::runningStateChanged);
|
||||
connect(_scriptEngine, &ScriptEngine::errorMessage, this, &ScriptEditorWidget::onScriptError);
|
||||
|
@ -186,10 +186,10 @@ bool ScriptEditorWidget::save() {
|
|||
|
||||
bool ScriptEditorWidget::saveAs() {
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save script"),
|
||||
Application::getInstance()->getPreviousScriptLocation(),
|
||||
qApp->getPreviousScriptLocation(),
|
||||
tr("JavaScript Files (*.js)"));
|
||||
if (!fileName.isEmpty()) {
|
||||
Application::getInstance()->setPreviousScriptLocation(fileName);
|
||||
qApp->setPreviousScriptLocation(fileName);
|
||||
return saveFile(fileName);
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -90,10 +90,10 @@ void ScriptEditorWindow::loadScriptMenu(const QString& scriptName) {
|
|||
|
||||
void ScriptEditorWindow::loadScriptClicked() {
|
||||
QString scriptName = QFileDialog::getOpenFileName(this, tr("Interface"),
|
||||
Application::getInstance()->getPreviousScriptLocation(),
|
||||
qApp->getPreviousScriptLocation(),
|
||||
tr("JavaScript Files (*.js)"));
|
||||
if (!scriptName.isEmpty()) {
|
||||
Application::getInstance()->setPreviousScriptLocation(scriptName);
|
||||
qApp->setPreviousScriptLocation(scriptName);
|
||||
addScriptEditorWidget("loading...")->loadFile(scriptName);
|
||||
updateButtons();
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ void ScriptEditorWindow::loadScriptClicked() {
|
|||
|
||||
void ScriptEditorWindow::loadMenuAboutToShow() {
|
||||
_loadMenu->clear();
|
||||
QStringList runningScripts = Application::getInstance()->getRunningScripts();
|
||||
QStringList runningScripts = qApp->getRunningScripts();
|
||||
if (runningScripts.count() > 0) {
|
||||
QSignalMapper* signalMapper = new QSignalMapper(this);
|
||||
foreach (const QString& runningScript, runningScripts) {
|
||||
|
|
|
@ -115,7 +115,7 @@ void Stats::updateStats(bool force) {
|
|||
STAT_UPDATE(avatarCount, avatarManager->size() - 1);
|
||||
STAT_UPDATE(serverCount, nodeList->size());
|
||||
STAT_UPDATE(framerate, (int)qApp->getFps());
|
||||
STAT_UPDATE(simrate, (int)Application::getInstance()->getAverageSimsPerSecond());
|
||||
STAT_UPDATE(simrate, (int)qApp->getAverageSimsPerSecond());
|
||||
STAT_UPDATE(avatarSimrate, (int)qApp->getAvatarSimrate());
|
||||
|
||||
auto bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
|
||||
|
@ -207,7 +207,7 @@ void Stats::updateStats(bool force) {
|
|||
unsigned long totalLeaves = 0;
|
||||
std::stringstream sendingModeStream("");
|
||||
sendingModeStream << "[";
|
||||
NodeToOctreeSceneStats* octreeServerSceneStats = Application::getInstance()->getOcteeSceneStats();
|
||||
NodeToOctreeSceneStats* octreeServerSceneStats = qApp->getOcteeSceneStats();
|
||||
for (NodeToOctreeSceneStatsIterator i = octreeServerSceneStats->begin(); i != octreeServerSceneStats->end(); i++) {
|
||||
//const QUuid& uuid = i->first;
|
||||
OctreeSceneStats& stats = i->second;
|
||||
|
|
|
@ -25,7 +25,7 @@ ToolWindow::ToolWindow(QWidget* parent) :
|
|||
# ifndef Q_OS_LINUX
|
||||
setDockOptions(QMainWindow::ForceTabbedDocks);
|
||||
# endif
|
||||
Application::getInstance()->installEventFilter(this);
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
||||
bool ToolWindow::event(QEvent* event) {
|
||||
|
@ -34,7 +34,7 @@ bool ToolWindow::event(QEvent* event) {
|
|||
if (!_hasShown) {
|
||||
_hasShown = true;
|
||||
|
||||
QMainWindow* mainWindow = Application::getInstance()->getWindow();
|
||||
QMainWindow* mainWindow = qApp->getWindow();
|
||||
QRect mainGeometry = mainWindow->geometry();
|
||||
|
||||
int titleBarHeight = UIUtil::getWindowTitleBarHeight(this);
|
||||
|
@ -57,7 +57,7 @@ bool ToolWindow::eventFilter(QObject* sender, QEvent* event) {
|
|||
# ifndef Q_OS_LINUX
|
||||
switch (event->type()) {
|
||||
case QEvent::WindowStateChange:
|
||||
if (Application::getInstance()->getWindow()->isMinimized()) {
|
||||
if (qApp->getWindow()->isMinimized()) {
|
||||
// If we are already visible, we are self-hiding
|
||||
_selfHidden = isVisible();
|
||||
setVisible(false);
|
||||
|
|
|
@ -30,7 +30,7 @@ QScriptValue Billboardable::getProperty(QScriptEngine* scriptEngine, const QStri
|
|||
void Billboardable::pointTransformAtCamera(Transform& transform, glm::quat offsetRotation) {
|
||||
if (isFacingAvatar()) {
|
||||
glm::vec3 billboardPos = transform.getTranslation();
|
||||
glm::vec3 cameraPos = Application::getInstance()->getCamera()->getPosition();
|
||||
glm::vec3 cameraPos = qApp->getCamera()->getPosition();
|
||||
glm::vec3 look = cameraPos - billboardPos;
|
||||
float elevation = -asinf(look.y / glm::length(look));
|
||||
float azimuth = atan2f(look.x, look.z);
|
||||
|
|
|
@ -71,7 +71,7 @@ void ModelOverlay::render(RenderArgs* args) {
|
|||
|
||||
// check to see if when we added our model to the scene they were ready, if they were not ready, then
|
||||
// fix them up in the scene
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
if (_model.needsFixupInScene()) {
|
||||
_model.removeFromScene(scene, pendingChanges);
|
||||
|
|
|
@ -76,7 +76,7 @@ void Overlays::update(float deltatime) {
|
|||
|
||||
void Overlays::cleanupOverlaysToDelete() {
|
||||
if (!_overlaysToDelete.isEmpty()) {
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
|
||||
{
|
||||
|
@ -169,7 +169,7 @@ unsigned int Overlays::addOverlay(const QString& type, const QScriptValue& prope
|
|||
} else if (type == Grid3DOverlay::TYPE) {
|
||||
thisOverlay = std::make_shared<Grid3DOverlay>();
|
||||
} else if (type == LocalModelsOverlay::TYPE) {
|
||||
thisOverlay = std::make_shared<LocalModelsOverlay>(Application::getInstance()->getEntityClipboardRenderer());
|
||||
thisOverlay = std::make_shared<LocalModelsOverlay>(qApp->getEntityClipboardRenderer());
|
||||
} else if (type == ModelOverlay::TYPE) {
|
||||
thisOverlay = std::make_shared<ModelOverlay>();
|
||||
} else if (type == Web3DOverlay::TYPE) {
|
||||
|
@ -196,7 +196,7 @@ unsigned int Overlays::addOverlay(Overlay::Pointer overlay) {
|
|||
} else {
|
||||
_overlaysWorld[thisID] = overlay;
|
||||
|
||||
render::ScenePointer scene = Application::getInstance()->getMain3DScene();
|
||||
render::ScenePointer scene = qApp->getMain3DScene();
|
||||
render::PendingChanges pendingChanges;
|
||||
|
||||
overlay->addToScene(overlay, scene, pendingChanges);
|
||||
|
|
Loading…
Reference in a new issue