mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 11:02:24 +02:00
Added a timeout to update the content holder parent after interactive window has finished loading
This commit is contained in:
parent
8e8c157567
commit
f8102be74d
6 changed files with 10 additions and 43 deletions
|
@ -72,7 +72,7 @@ Windows.Window {
|
|||
|
||||
function delay(delayTimeMS, delayFunction) {
|
||||
timer.interval = delayTimeMS;
|
||||
timer.repeat = true;
|
||||
timer.repeat = false;
|
||||
timer.triggered.connect(delayFunction);
|
||||
timer.start();
|
||||
}
|
||||
|
@ -108,14 +108,8 @@ Windows.Window {
|
|||
function updateContentParent() {
|
||||
if (presentationMode === Desktop.PresentationMode.VIRTUAL) {
|
||||
contentHolder.parent = root;
|
||||
print("INTERACTIVEWINDOWQML CHANGED CONTENT PARENT TO ROOT. CONTENT HOLDER PARENT IS ", contentHolder.parent);
|
||||
} else if (presentationMode === Desktop.PresentationMode.NATIVE && nativeWindow) {
|
||||
contentHolder.parent = nativeWindow.contentItem;
|
||||
print("INTERACTIVEWINDOWQML CHANGED CONTENT PARENT TO NATIVE WINDOW CONTENTITEM: ", nativeWindow.contentItem, ". CONTENT HOLDER PARENT IS ", contentHolder.parent);
|
||||
} else if (!nativeWindow) {
|
||||
print("INTERACTIVEWINDOWQML COULD NOT CHANGE CONTENT PARENT. NO NATIVE WINDOW.");
|
||||
} else {
|
||||
print("INTERACTIVEWINDOWQML COULD OT CHANGE CONTENT PARENT BUT HAVE A NATIVE WINDOW");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,20 +123,16 @@ Windows.Window {
|
|||
} else if (presentationMode === Desktop.PresentationMode.NATIVE) {
|
||||
shown = false;
|
||||
if (nativeWindow) {
|
||||
print("INTERACTIVEWINDOWQML SET UP PRES MODE FOUND NATIVE WINDOW");
|
||||
updateInteractiveWindowPositionForMode();
|
||||
nativeWindow.setVisible(interactiveWindowVisible);
|
||||
} else {
|
||||
print("INTERACTIVEWINDOWQML SET UP PRES MODE DID NOT FIND NATIVE WINDOW");
|
||||
}
|
||||
} else if (presentationMode === modeNotSet) {
|
||||
console.error("presentationMode should be set");
|
||||
console.error("presentationMode should be set.");
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
print("INTERACTIVEWINDOWQML ONROOTCOMPLETED COMPLETED. ID IS ", this, " . CONTENT HOLDER PARENT IS ", contentHolder.parent);
|
||||
|
||||
|
||||
x = interactiveWindowPosition.x;
|
||||
y = interactiveWindowPosition.y;
|
||||
width = interactiveWindowSize.width;
|
||||
|
@ -157,8 +147,9 @@ Windows.Window {
|
|||
width: interactiveWindowSize.width
|
||||
height: interactiveWindowSize.height
|
||||
Component.onCompleted: {
|
||||
// calling setupPresentationMode from here does not work because the fn will not find the native window
|
||||
print("INTERACTIVEWINDOWQML NATIVE WINDOW COMPLETED. ID IS ", this, " CONTENT HOLDER PARENT IS ", contentHolder.parent);
|
||||
delay(500, function() {
|
||||
updateContentParent();
|
||||
});
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -213,11 +204,10 @@ Windows.Window {
|
|||
closeEvent.accepted = false;
|
||||
windowClosed();
|
||||
});
|
||||
|
||||
|
||||
// finally set the initial window mode:
|
||||
setupPresentationMode();
|
||||
updateContentParent();
|
||||
//TODO move this to wherever initialization is actually completed
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
@ -342,11 +332,5 @@ Windows.Window {
|
|||
Item {
|
||||
id: contentHolder
|
||||
anchors.fill: parent
|
||||
Component.onCompleted: {
|
||||
print("INTERACTIVEWINDOWQML CONTENTHOLDER COMPLETED. ID IS ", contentHolder, " . CONTENT HOLDER PARENT IS ", contentHolder.parent);
|
||||
}
|
||||
onParentChanged: {
|
||||
print("INTERACTIVEWINDOWQML NATIVE WINDOW PARENT CHANGED. CONTENT HOLDER PARENT IS ", contentHolder.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,6 @@ void DesktopScriptingInterface::show(const QString& path, const QString& title)
|
|||
}
|
||||
|
||||
InteractiveWindowPointer DesktopScriptingInterface::createWindow(const QString& sourceUrl, const QVariantMap& properties) {
|
||||
qDebug() << "CREATING WINDOW WITH URL " << sourceUrl << " AND PROPERTIES " << properties;
|
||||
if (QThread::currentThread() != thread()) {
|
||||
InteractiveWindowPointer interactiveWindow = nullptr;
|
||||
BLOCKING_INVOKE_METHOD(this, "createWindowOnThread",
|
||||
|
@ -141,8 +140,7 @@ InteractiveWindowPointer DesktopScriptingInterface::createWindow(const QString&
|
|||
Q_ARG(QString, sourceUrl),
|
||||
Q_ARG(QVariantMap, properties),
|
||||
Q_ARG(QThread*, QThread::currentThread()));
|
||||
qDebug() << "RETURNING INTERACTIVE WINDOW " << interactiveWindow;
|
||||
return interactiveWindow;
|
||||
return interactiveWindow;
|
||||
}
|
||||
|
||||
|
||||
|
@ -163,10 +161,8 @@ InteractiveWindowPointer DesktopScriptingInterface::createWindowOnThread(const Q
|
|||
// that the source URL is permitted
|
||||
const auto& urlValidator = OffscreenQmlSurface::getUrlValidator();
|
||||
if (!urlValidator(sourceUrl)) {
|
||||
qDebug("INTERACTIVE WINDOW SOURCE URL WAS NOT VALID");
|
||||
return nullptr;
|
||||
}
|
||||
qDebug() << "WINDOW SOURCE URL: " << sourceUrl;
|
||||
InteractiveWindowPointer window = new InteractiveWindow(sourceUrl, properties, _restricted);
|
||||
window->moveToThread(targetThread);
|
||||
return window;
|
||||
|
|
|
@ -167,7 +167,6 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
|||
&InteractiveWindowProxy::emitScriptEvent, Qt::QueuedConnection);
|
||||
|
||||
if (properties.contains(DOCKED_PROPERTY) && presentationMode == InteractiveWindowPresentationMode::Native) {
|
||||
qDebug() << "CREATING WINDOW THAT IS DOCKED WITH NATIVE PRES MODE";
|
||||
QVariantMap nativeWindowInfo = properties[DOCKED_PROPERTY].toMap();
|
||||
Qt::DockWidgetArea dockArea = Qt::TopDockWidgetArea;
|
||||
QString title;
|
||||
|
@ -196,7 +195,6 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
|||
* @property {InteractiveWindow.DockArea} dockArea - The edge of the Interface window to dock to.
|
||||
*/
|
||||
if (nativeWindowInfo.contains(DOCK_AREA_PROPERTY)) {
|
||||
qDebug() << "CREATING DOCK AREA FOR NATIVE WINDOW " << DOCK_AREA_PROPERTY;
|
||||
DockArea dockedArea = (DockArea) nativeWindowInfo[DOCK_AREA_PROPERTY].toInt();
|
||||
int tempWidth = 0;
|
||||
int tempHeight = 0;
|
||||
|
@ -255,7 +253,6 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
|||
_dockWidget->setObjectName("DockedWidget");
|
||||
mainWindow->addDockWidget(dockArea, _dockWidget.get());
|
||||
} else {
|
||||
qDebug() << "CREATING OTHER WINDOW (NOT DOCKED WITH NATIVE PRES MODE)";
|
||||
auto contextInitLambda = [&](QQmlContext* context) {
|
||||
// If the restricted flag is on, the web content will not be able to access local files
|
||||
ContextAwareProfile::restrictContext(context, restricted);
|
||||
|
@ -339,7 +336,6 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
|
|||
if (!KNOWN_SCHEMES.contains(sourceURL.scheme(), Qt::CaseInsensitive)) {
|
||||
sourceURL = QUrl::fromLocalFile(sourceURL.toString()).toString();
|
||||
}
|
||||
qDebug() << "CREATING OTHER WINDOW WITH SOURCE URL: " << sourceUrl;
|
||||
object->setObjectName("InteractiveWindow");
|
||||
object->setProperty(SOURCE_PROPERTY, sourceURL);
|
||||
};
|
||||
|
|
|
@ -380,7 +380,6 @@ function onMessageFromEmoteAppBar(message) {
|
|||
if (message.source !== EMOTE_APP_BAR_MESSAGE_SOURCE) {
|
||||
return;
|
||||
}
|
||||
print("EMOTE WINDOW MESSAGE");
|
||||
switch (message.method) {
|
||||
case "positive":
|
||||
if (!message.data.isPressingAndHolding) {
|
||||
|
@ -522,11 +521,9 @@ var EMOTE_APP_BAR_WINDOW_FLAGS = 0x00000001 | // Qt::Window
|
|||
var emoteAppBarWindow = false;
|
||||
function showEmoteAppBar() {
|
||||
if (emoteAppBarWindow) {
|
||||
print("EMOTE APP BAR WINDOW ALREADY EXISTS. DO NOT SHOW AGAIN.");
|
||||
return;
|
||||
}
|
||||
|
||||
print("CREATE EMOTE WINDOW");
|
||||
emoteAppBarWindow = Desktop.createWindow(EMOTE_APP_BAR_QML_PATH, {
|
||||
title: EMOTE_APP_BAR_WINDOW_TITLE,
|
||||
presentationMode: EMOTE_APP_BAR_PRESENTATION_MODE,
|
||||
|
@ -542,7 +539,6 @@ function showEmoteAppBar() {
|
|||
overrideFlags: EMOTE_APP_BAR_WINDOW_FLAGS
|
||||
});
|
||||
|
||||
print("EMOTE APP BAR WINDOW CREATED: ", emoteAppBarWindow);
|
||||
emoteAppBarWindow.fromQml.connect(onMessageFromEmoteAppBar);
|
||||
}
|
||||
|
||||
|
@ -552,7 +548,6 @@ function showEmoteAppBar() {
|
|||
// We should add that functionality to the Window Scripting Interface, and remove `isWindowMinimized` below.
|
||||
var isWindowMinimized = false;
|
||||
function maybeChangeEmoteIndicatorVisibility(desiredVisibility) {
|
||||
print("MAYBE CHANGE EMOTE WINDOW VISIBILITY ", desiredVisibility);
|
||||
if (isWindowMinimized || HMD.active) {
|
||||
desiredVisibility = false;
|
||||
}
|
||||
|
@ -587,7 +582,6 @@ var emojiCodeMap;
|
|||
var customEmojiCodeMap;
|
||||
var _this;
|
||||
function setup() {
|
||||
print("STARTING EMOTE SCRIPT");
|
||||
deleteOldReticles();
|
||||
|
||||
// make a map of just the utf codes to help with accesing
|
||||
|
|
|
@ -39,9 +39,6 @@ Rectangle {
|
|||
readonly property string emoteIconSource: "images/emote_Icon.svg"
|
||||
property bool allowEmoteDrawerExpansion: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true)
|
||||
|
||||
Component.onCompleted: {
|
||||
print("EMOTE APP BAR ROOT WINDOW HAS COMPLETED LOADING");
|
||||
}
|
||||
|
||||
onRequestedWidthChanged: {
|
||||
root.requestNewWidth(root.requestedWidth);
|
||||
|
|
|
@ -718,7 +718,7 @@ function restoreLODSettings() {
|
|||
|
||||
var nametag = Script.require("./simplifiedNametag/simplifiedNametag.js");
|
||||
var si = Script.require("./simplifiedStatusIndicator/simplifiedStatusIndicator.js");
|
||||
var simplifiedEmote = Script.require("../simplifiedEmote/simplifiedEmote.js?" + Date.now());
|
||||
var simplifiedEmote = Script.require("../simplifiedEmote/simplifiedEmote.js");
|
||||
var oldShowAudioTools;
|
||||
var oldShowBubbleTools;
|
||||
var keepExistingUIAndScriptsSetting = Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false);
|
||||
|
|
Loading…
Reference in a new issue