mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 11:42:55 +02:00
Merge branch 'ui-refactor' into menu2
This commit is contained in:
commit
198224c4ec
13 changed files with 47 additions and 48 deletions
|
@ -1088,7 +1088,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
|
||||||
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
|
||||||
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
bool isOption = event->modifiers().testFlag(Qt::AltModifier);
|
||||||
bool isKeypad = event->modifiers().testFlag(Qt::KeypadModifier);
|
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
|
|
|
@ -257,7 +257,6 @@ void ApplicationOverlay::displayOverlayTexture() {
|
||||||
if (_alpha == 0.0f) {
|
if (_alpha == 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto glCanvas = Application::getInstance()->getGLWidget();
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix(); {
|
glPushMatrix(); {
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
|
@ -1080,7 +1080,6 @@ const float MIN_ALIGNMENT_DOT = 0.999999f;
|
||||||
const float MIN_VELOCITY_DELTA = 0.01f;
|
const float MIN_VELOCITY_DELTA = 0.01f;
|
||||||
const float MIN_DAMPING_DELTA = 0.001f;
|
const float MIN_DAMPING_DELTA = 0.001f;
|
||||||
const float MIN_GRAVITY_DELTA = 0.001f;
|
const float MIN_GRAVITY_DELTA = 0.001f;
|
||||||
const float MIN_ACCELERATION_DELTA = 0.001f;
|
|
||||||
const float MIN_SPIN_DELTA = 0.0003f;
|
const float MIN_SPIN_DELTA = 0.0003f;
|
||||||
|
|
||||||
void EntityItem::updatePositionInDomainUnits(const glm::vec3& value) {
|
void EntityItem::updatePositionInDomainUnits(const glm::vec3& value) {
|
||||||
|
|
|
@ -16,8 +16,8 @@ GLBackend::GLTexture::GLTexture() :
|
||||||
_storageStamp(0),
|
_storageStamp(0),
|
||||||
_contentStamp(0),
|
_contentStamp(0),
|
||||||
_texture(0),
|
_texture(0),
|
||||||
_size(0),
|
_target(GL_TEXTURE_2D),
|
||||||
_target(GL_TEXTURE_2D)
|
_size(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
GLBackend::GLTexture::~GLTexture() {
|
GLBackend::GLTexture::~GLTexture() {
|
||||||
|
@ -176,6 +176,8 @@ public:
|
||||||
texel.internalFormat = GL_DEPTH_COMPONENT24;
|
texel.internalFormat = GL_DEPTH_COMPONENT24;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case gpu::NUM_TYPES:
|
||||||
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -8,11 +8,9 @@
|
||||||
|
|
||||||
const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f);
|
const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f);
|
||||||
const float DEFAULT_GRAVITY = -5.0f;
|
const float DEFAULT_GRAVITY = -5.0f;
|
||||||
const float TERMINAL_VELOCITY = 55.0f;
|
|
||||||
const float JUMP_SPEED = 3.5f;
|
const float JUMP_SPEED = 3.5f;
|
||||||
|
|
||||||
const float MAX_FALL_HEIGHT = 20.0f;
|
const float MAX_FALL_HEIGHT = 20.0f;
|
||||||
const float MIN_HOVER_HEIGHT = 3.0f;
|
|
||||||
|
|
||||||
const uint32_t PENDING_FLAG_ADD_TO_SIMULATION = 1U << 0;
|
const uint32_t PENDING_FLAG_ADD_TO_SIMULATION = 1U << 0;
|
||||||
const uint32_t PENDING_FLAG_REMOVE_FROM_SIMULATION = 1U << 1;
|
const uint32_t PENDING_FLAG_REMOVE_FROM_SIMULATION = 1U << 1;
|
||||||
|
|
|
@ -111,7 +111,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));
|
slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3));
|
||||||
|
|
||||||
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));
|
gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader));
|
||||||
bool makeResult = gpu::Shader::makeProgram(*program, slotBindings);
|
gpu::Shader::makeProgram(*program, slotBindings);
|
||||||
|
|
||||||
|
|
||||||
auto locations = std::shared_ptr<Locations>(new Locations());
|
auto locations = std::shared_ptr<Locations>(new Locations());
|
||||||
|
@ -139,7 +139,7 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
|
||||||
|
|
||||||
// Good to go add the brand new pipeline
|
// Good to go add the brand new pipeline
|
||||||
auto pipeline = gpu::PipelinePointer(gpu::Pipeline::create(program, state));
|
auto pipeline = gpu::PipelinePointer(gpu::Pipeline::create(program, state));
|
||||||
auto it = insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations)));
|
insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations)));
|
||||||
|
|
||||||
// If not a shadow pass, create the mirror version from the same state, just change the FrontFace
|
// If not a shadow pass, create the mirror version from the same state, just change the FrontFace
|
||||||
if (!key.isShadow()) {
|
if (!key.isShadow()) {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
//
|
||||||
|
// HifiMenu.cpp
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2015/04/21
|
||||||
|
// Copyright 2015 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 "HifiMenu.h"
|
#include "HifiMenu.h"
|
||||||
#include <QtQml>
|
#include <QtQml>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// MenuConstants.h
|
// HifiMenu.h
|
||||||
//
|
//
|
||||||
// Created by Bradley Austin Davis on 2015/04/21
|
// Created by Bradley Austin Davis on 2015/04/21
|
||||||
// Copyright 2015 High Fidelity, Inc.
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
@ -9,8 +9,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifndef hifi_MenuContants_h
|
#ifndef hifi_HifiMenu_h
|
||||||
#define hifi_MenuConstants_h
|
#define hifi_HifiMenu_h
|
||||||
|
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
@ -44,7 +44,7 @@ protected:
|
||||||
friend class MenuUserData;
|
friend class MenuUserData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_MenuConstants_h
|
#endif // hifi_HifiMenu_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// MessageDialog.cpp
|
// MessageDialog.cpp
|
||||||
//
|
//
|
||||||
// Created by Bradley Austin Davis on 2015/04/14
|
// Created by Bradley Austin Davis on 2015/04/14
|
||||||
|
@ -12,7 +11,7 @@
|
||||||
|
|
||||||
HIFI_QML_DEF(MessageDialog)
|
HIFI_QML_DEF(MessageDialog)
|
||||||
|
|
||||||
MessageDialog::MessageDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) {
|
MessageDialog::MessageDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
|
||||||
_buttons = StandardButtons(Ok | Cancel);
|
_buttons = StandardButtons(Ok | Cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,21 +38,21 @@ void MessageDialog::setVisible(bool v) {
|
||||||
OffscreenQmlDialog::setVisible(v);
|
OffscreenQmlDialog::setVisible(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageDialog::setText(const QString &arg) {
|
void MessageDialog::setText(const QString& arg) {
|
||||||
if (arg != _text) {
|
if (arg != _text) {
|
||||||
_text = arg;
|
_text = arg;
|
||||||
emit textChanged();
|
emit textChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageDialog::setInformativeText(const QString &arg) {
|
void MessageDialog::setInformativeText(const QString& arg) {
|
||||||
if (arg != _informativeText) {
|
if (arg != _informativeText) {
|
||||||
_informativeText = arg;
|
_informativeText = arg;
|
||||||
emit informativeTextChanged();
|
emit informativeTextChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageDialog::setDetailedText(const QString &arg) {
|
void MessageDialog::setDetailedText(const QString& arg) {
|
||||||
if (arg != _detailedText) {
|
if (arg != _detailedText) {
|
||||||
_detailedText = arg;
|
_detailedText = arg;
|
||||||
emit detailedTextChanged();
|
emit detailedTextChanged();
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
NRoles
|
NRoles
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageDialog(QQuickItem *parent = 0);
|
MessageDialog(QQuickItem* parent = 0);
|
||||||
virtual ~MessageDialog();
|
virtual ~MessageDialog();
|
||||||
|
|
||||||
QString text() const;
|
QString text() const;
|
||||||
|
@ -57,9 +57,9 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void setVisible(bool v);
|
virtual void setVisible(bool v);
|
||||||
void setText(const QString &arg);
|
void setText(const QString& arg);
|
||||||
void setInformativeText(const QString &arg);
|
void setInformativeText(const QString& arg);
|
||||||
void setDetailedText(const QString &arg);
|
void setDetailedText(const QString& arg);
|
||||||
void setIcon(Icon icon);
|
void setIcon(Icon icon);
|
||||||
void setStandardButtons(StandardButtons buttons);
|
void setStandardButtons(StandardButtons buttons);
|
||||||
void setResultCallback(OffscreenUi::ButtonCallback callback);
|
void setResultCallback(OffscreenUi::ButtonCallback callback);
|
||||||
|
@ -98,7 +98,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_MessageDialog_h
|
#endif // hifi_MessageDialog_h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ QString OffscreenQmlDialog::title() const {
|
||||||
return _title;
|
return _title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlDialog::setTitle(const QString &arg) {
|
void OffscreenQmlDialog::setTitle(const QString& title) {
|
||||||
if (arg != _title) {
|
if (title != _title) {
|
||||||
_title = arg;
|
_title = title;
|
||||||
emit titleChanged();
|
emit titleChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString title() const;
|
QString title() const;
|
||||||
void setTitle(const QString &arg);
|
void setTitle(const QString& title);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void accepted();
|
void accepted();
|
||||||
|
|
|
@ -140,13 +140,6 @@ QQuickItem* OffscreenUi::getRootItem() {
|
||||||
return _rootItem;
|
return _rootItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
//QQmlContext* OffscreenUi::qmlContext() {
|
|
||||||
// if (nullptr == _rootItem) {
|
|
||||||
// return _qmlComponent->creationContext();
|
|
||||||
// }
|
|
||||||
// return QQmlEngine::contextForObject(_rootItem);
|
|
||||||
//}
|
|
||||||
|
|
||||||
void OffscreenUi::setBaseUrl(const QUrl& baseUrl) {
|
void OffscreenUi::setBaseUrl(const QUrl& baseUrl) {
|
||||||
_qmlEngine->setBaseUrl(baseUrl);
|
_qmlEngine->setBaseUrl(baseUrl);
|
||||||
}
|
}
|
||||||
|
@ -187,7 +180,7 @@ QObject* OffscreenUi::finishQmlLoad(std::function<void(QQmlContext*, QObject*)>
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlContext * newContext = new QQmlContext(_qmlEngine, qApp);
|
QQmlContext* newContext = new QQmlContext(_qmlEngine, qApp);
|
||||||
QObject* newObject = _qmlComponent->beginCreate(newContext);
|
QObject* newObject = _qmlComponent->beginCreate(newContext);
|
||||||
if (_qmlComponent->isError()) {
|
if (_qmlComponent->isError()) {
|
||||||
QList<QQmlError> errorList = _qmlComponent->errors();
|
QList<QQmlError> errorList = _qmlComponent->errors();
|
||||||
|
@ -293,9 +286,9 @@ QPointF OffscreenUi::mapWindowToUi(const QPointF& sourcePosition, QObject* sourc
|
||||||
//
|
//
|
||||||
// However, the problem may go away once we switch to the new menu system,
|
// However, the problem may go away once we switch to the new menu system,
|
||||||
// so I think it's OK for the time being.
|
// so I think it's OK for the time being.
|
||||||
bool OffscreenUi::shouldSwallowShortcut(QEvent * event) {
|
bool OffscreenUi::shouldSwallowShortcut(QEvent* event) {
|
||||||
Q_ASSERT(event->type() == QEvent::ShortcutOverride);
|
Q_ASSERT(event->type() == QEvent::ShortcutOverride);
|
||||||
QObject * focusObject = _quickWindow->focusObject();
|
QObject* focusObject = _quickWindow->focusObject();
|
||||||
if (focusObject != _quickWindow && focusObject != _rootItem) {
|
if (focusObject != _quickWindow && focusObject != _rootItem) {
|
||||||
//qDebug() << "Swallowed shortcut " << static_cast<QKeyEvent*>(event)->key();
|
//qDebug() << "Swallowed shortcut " << static_cast<QKeyEvent*>(event)->key();
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -318,7 +311,7 @@ bool OffscreenUi::eventFilter(QObject* originalDestination, QEvent* event) {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Don't intercept our own events, or we enter an infinite recursion
|
// Don't intercept our own events, or we enter an infinite recursion
|
||||||
QObject * recurseTest = originalDestination;
|
QObject* recurseTest = originalDestination;
|
||||||
while (recurseTest) {
|
while (recurseTest) {
|
||||||
Q_ASSERT(recurseTest != _rootItem && recurseTest != _quickWindow);
|
Q_ASSERT(recurseTest != _rootItem && recurseTest != _quickWindow);
|
||||||
recurseTest = recurseTest->parent();
|
recurseTest = recurseTest->parent();
|
||||||
|
@ -442,13 +435,13 @@ void OffscreenUi::messageBox(const QString& title, const QString& text,
|
||||||
ButtonCallback callback,
|
ButtonCallback callback,
|
||||||
QMessageBox::Icon icon,
|
QMessageBox::Icon icon,
|
||||||
QMessageBox::StandardButtons buttons) {
|
QMessageBox::StandardButtons buttons) {
|
||||||
MessageDialog * pDialog{ nullptr };
|
MessageDialog* pDialog{ nullptr };
|
||||||
MessageDialog::show([&](QQmlContext*ctx, QObject*item) {
|
MessageDialog::show([&](QQmlContext* ctx, QObject* item) {
|
||||||
pDialog = item->findChild<MessageDialog*>();
|
pDialog = item->findChild<MessageDialog*>();
|
||||||
pDialog->setIcon((MessageDialog::Icon)icon);
|
pDialog->setIcon((MessageDialog::Icon)icon);
|
||||||
pDialog->setTitle(title);
|
pDialog->setTitle(title);
|
||||||
pDialog->setText(text);
|
pDialog->setText(text);
|
||||||
pDialog->setStandardButtons(MessageDialog::StandardButtons((int)buttons));
|
pDialog->setStandardButtons(MessageDialog::StandardButtons(static_cast<int>(buttons)));
|
||||||
pDialog->setResultCallback(callback);
|
pDialog->setResultCallback(callback);
|
||||||
});
|
});
|
||||||
pDialog->setEnabled(true);
|
pDialog->setEnabled(true);
|
||||||
|
@ -457,25 +450,29 @@ void OffscreenUi::messageBox(const QString& title, const QString& text,
|
||||||
void OffscreenUi::information(const QString& title, const QString& text,
|
void OffscreenUi::information(const QString& title, const QString& text,
|
||||||
ButtonCallback callback,
|
ButtonCallback callback,
|
||||||
QMessageBox::StandardButtons buttons) {
|
QMessageBox::StandardButtons buttons) {
|
||||||
messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Information, buttons);
|
messageBox(title, text, callback,
|
||||||
|
static_cast<QMessageBox::Icon>(MessageDialog::Information), buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenUi::question(const QString& title, const QString& text,
|
void OffscreenUi::question(const QString& title, const QString& text,
|
||||||
ButtonCallback callback,
|
ButtonCallback callback,
|
||||||
QMessageBox::StandardButtons buttons) {
|
QMessageBox::StandardButtons buttons) {
|
||||||
messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Question, buttons);
|
messageBox(title, text, callback,
|
||||||
|
static_cast<QMessageBox::Icon>(MessageDialog::Question), buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenUi::warning(const QString& title, const QString& text,
|
void OffscreenUi::warning(const QString& title, const QString& text,
|
||||||
ButtonCallback callback,
|
ButtonCallback callback,
|
||||||
QMessageBox::StandardButtons buttons) {
|
QMessageBox::StandardButtons buttons) {
|
||||||
messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Warning, buttons);
|
messageBox(title, text, callback,
|
||||||
|
static_cast<QMessageBox::Icon>(MessageDialog::Warning), buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenUi::critical(const QString& title, const QString& text,
|
void OffscreenUi::critical(const QString& title, const QString& text,
|
||||||
ButtonCallback callback,
|
ButtonCallback callback,
|
||||||
QMessageBox::StandardButtons buttons) {
|
QMessageBox::StandardButtons buttons) {
|
||||||
messageBox(title, text, callback, (QMessageBox::Icon)MessageDialog::Critical, buttons);
|
messageBox(title, text, callback,
|
||||||
|
static_cast<QMessageBox::Icon>(MessageDialog::Critical), buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue