Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Omega Hereon [J.L.] 2016-04-18 17:40:44 +00:00
commit 8db8d1e31d
9 changed files with 58 additions and 18 deletions

View file

@ -17,7 +17,7 @@ import "windows"
Window {
id: root
HifiConstants { id: hifi }
anchors.centerIn: parent
objectName: "AddressBarDialog"
frame: HiddenFrame {}
@ -29,6 +29,19 @@ Window {
width: addressBarDialog.implicitWidth
height: addressBarDialog.implicitHeight
Component.onCompleted: {
root.parentChanged.connect(center);
center();
}
Component.onDestruction: {
root.parentChanged.disconnect(center);
}
function center() {
// Explicitly center in order to avoid warnings at shutdown
anchors.centerIn = parent;
}
AddressBarDialog {
id: addressBarDialog
implicitWidth: backgroundImage.width

View file

@ -3,10 +3,24 @@ import QtQuick 2.3
import QtQuick.Controls 1.2
Item {
anchors.fill: parent
id: stats
anchors.leftMargin: 300
objectName: "StatsItem"
Component.onCompleted: {
stats.parentChanged.connect(fill);
fill();
}
Component.onDestruction: {
stats.parentChanged.disconnect(fill);
}
function fill() {
// Explicitly fill in order to avoid warnings at shutdown
anchors.fill = parent;
}
Hifi.Stats {
id: root
objectName: "Stats"

View file

@ -248,9 +248,15 @@ Fadable {
children: [ swallower, frame, pane, activator ]
Component.onCompleted: { raise(); setDefaultFocus(); }
Component.onDestruction: windowDestroyed();
onParentChanged: raise();
Component.onCompleted: {
window.parentChanged.connect(raise);
raise();
setDefaultFocus();
}
Component.onDestruction: {
window.parentChanged.disconnect(raise); // Prevent warning on shutdown
windowDestroyed();
}
onVisibleChanged: {
if (!visible && destroyOnInvisible) {

View file

@ -114,9 +114,14 @@ Fadable {
children: [ swallower, frame, content, activator ]
Component.onCompleted: raise();
Component.onDestruction: windowDestroyed();
onParentChanged: raise();
Component.onCompleted: {
window.parentChanged.connect(raise);
raise();
}
Component.onDestruction: {
window.parentChanged.disconnect(raise); // Prevent warning on shutdown
windowDestroyed();
}
onVisibleChanged: {
if (!visible && destroyOnInvisible) {

View file

@ -1150,6 +1150,9 @@ void Application::aboutToQuit() {
getActiveDisplayPlugin()->deactivate();
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
DependencyManager::get<OffscreenUi>()->hide("RunningScripts");
_aboutToQuit = true;
cleanupBeforeQuit();

View file

@ -221,13 +221,6 @@ Texture* Texture::create(Type type, const Element& texelFormat, uint16 width, ui
return tex;
}
Texture* Texture::createFromStorage(Storage* storage) {
Texture* tex = new Texture();
tex->_storage.reset(storage);
storage->assignTexture(tex);
return tex;
}
Texture::Texture():
Resource()
{

View file

@ -260,7 +260,7 @@ public:
Stamp bumpStamp() { return ++_stamp; }
protected:
Stamp _stamp = 0;
Texture* _texture = nullptr;
Texture* _texture = nullptr; // Points to the parent texture (not owned)
Texture::Type _type = Texture::TEX_2D; // The type of texture is needed to know the number of faces to expect
std::vector<std::vector<PixelsPointer>> _mips; // an array of mips, each mip is an array of faces
@ -280,8 +280,6 @@ public:
static Texture* create3D(const Element& texelFormat, uint16 width, uint16 height, uint16 depth, const Sampler& sampler = Sampler());
static Texture* createCube(const Element& texelFormat, uint16 width, const Sampler& sampler = Sampler());
static Texture* createFromStorage(Storage* storage);
Texture();
Texture(const Texture& buf); // deep copy of the sysmem texture
Texture& operator=(const Texture& buf); // deep copy of the sysmem texture

View file

@ -143,6 +143,13 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
}
}
void OffscreenUi::hide(const QString& name) {
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
if (item) {
item->setVisible(false);
}
}
class ModalDialogListener : public QObject {
Q_OBJECT
friend class OffscreenUi;

View file

@ -37,6 +37,7 @@ public:
virtual void create(QOpenGLContext* context) override;
void createDesktop(const QUrl& url);
void show(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
void hide(const QString& name);
void toggle(const QUrl& url, const QString& name, std::function<void(QQmlContext*, QObject*)> f = [](QQmlContext*, QObject*) {});
bool shouldSwallowShortcut(QEvent* event);
bool navigationFocused();