diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml index 615c67fa..92e7ef6d 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml @@ -126,7 +126,7 @@ Page { width: 22 onClicked: { - var component = Qt.createComponent("qrc:/qml/QuickSwitcher.qml"); + var component = Qt.createComponent("qrc:/resources/qml/QuickSwitcher.qml"); if (component.status == Component.Ready) { var quickSwitch = component.createObject(timelineRoot); quickSwitch.open(); @@ -162,7 +162,7 @@ Page { function openUserProfile() { Nheko.updateUserProfile(); - var component = Qt.createComponent("qrc:/qml/dialogs/UserProfile.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/UserProfile.qml"); if (component.status == Component.Ready) { var userProfile = component.createObject(timelineRoot, { "profile": Nheko.currentUser diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml index 85c10ddd..2880a0c7 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml @@ -36,7 +36,7 @@ Pane { // repeat: true //} function showAliasEditor(settings) { - var component = Qt.createComponent("qrc:/qml/dialogs/AliasEditor.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/AliasEditor.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "roomSettings": settings @@ -48,7 +48,7 @@ Pane { } } function showAllowedRoomsEditor(settings) { - var component = Qt.createComponent("qrc:/qml/dialogs/AllowedRoomsSettingsDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/AllowedRoomsSettingsDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "roomSettings": settings @@ -60,7 +60,7 @@ Pane { } } function showPLEditor(settings) { - var component = Qt.createComponent("qrc:/qml/dialogs/PowerLevelEditor.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/PowerLevelEditor.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "roomSettings": settings @@ -72,7 +72,7 @@ Pane { } } function showSpacePLApplyPrompt(settings, editingModel) { - var component = Qt.createComponent("qrc:/qml/dialogs/PowerLevelSpacesApplyDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/PowerLevelSpacesApplyDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "roomSettings": settings, @@ -114,7 +114,7 @@ Pane { sequence: "Ctrl+K" onActivated: { - var component = Qt.createComponent("qrc:/qml/QuickSwitcher.qml"); + var component = Qt.createComponent("qrc:/resources/qml/QuickSwitcher.qml"); if (component.status == Component.Ready) { var quickSwitch = component.createObject(timelineRoot); quickSwitch.open(); @@ -142,7 +142,7 @@ Pane { } Connections { function onOpenJoinRoomDialog() { - var component = Qt.createComponent("qrc:/qml/dialogs/JoinRoomDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/JoinRoomDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot); dialog.show(); @@ -152,7 +152,7 @@ Pane { } } function onOpenLogoutDialog() { - var component = Qt.createComponent("qrc:/qml/dialogs/LogoutDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/LogoutDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot); dialog.open(); @@ -162,7 +162,7 @@ Pane { } } function onShowRoomJoinPrompt(summary) { - var component = Qt.createComponent("qrc:/qml/dialogs/ConfirmJoinRoomDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/ConfirmJoinRoomDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "summary": summary @@ -178,7 +178,7 @@ Pane { } Connections { function onNewDeviceVerificationRequest(flow) { - var component = Qt.createComponent("qrc:/qml/device-verification/DeviceVerification.qml"); + var component = Qt.createComponent("qrc:/resources/qml/device-verification/DeviceVerification.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "flow": flow @@ -194,7 +194,7 @@ Pane { } Connections { function onOpenInviteUsersDialog(invitees) { - var component = Qt.createComponent("qrc:/qml/dialogs/InviteDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/InviteDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "invitees": invitees @@ -206,7 +206,7 @@ Pane { } } function onOpenLeaveRoomDialog(roomid, reason) { - var component = Qt.createComponent("qrc:/qml/dialogs/LeaveRoomDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/LeaveRoomDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "roomId": roomid, @@ -219,7 +219,7 @@ Pane { } } function onOpenProfile(profile) { - var component = Qt.createComponent("qrc:/qml/dialogs/UserProfile.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/UserProfile.qml"); if (component.status == Component.Ready) { var userProfile = component.createObject(timelineRoot, { "profile": profile @@ -231,7 +231,7 @@ Pane { } } function onOpenRoomMembersDialog(members, room) { - var component = Qt.createComponent("qrc:/qml/dialogs/RoomMembers.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/RoomMembers.qml"); if (component.status == Component.Ready) { var membersDialog = component.createObject(timelineRoot, { "members": members, @@ -244,7 +244,7 @@ Pane { } } function onOpenRoomSettingsDialog(settings) { - var component = Qt.createComponent("qrc:/qml/dialogs/RoomSettings.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/RoomSettings.qml"); if (component.status == Component.Ready) { var roomSettings = component.createObject(timelineRoot, { "roomSettings": settings @@ -256,7 +256,7 @@ Pane { } } function onShowImageOverlay(room, eventId, url, originalWidth, proportionalHeight) { - var component = Qt.createComponent("qrc:/qml/dialogs/ImageOverlay.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/ImageOverlay.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "room": room, @@ -272,7 +272,7 @@ Pane { } } function onShowImagePackSettings(room, packlist) { - var component = Qt.createComponent("qrc:/qml/dialogs/ImagePackSettingsDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/ImagePackSettingsDialog.qml"); if (component.status == Component.Ready) { var packSet = component.createObject(timelineRoot, { "room": room, @@ -290,7 +290,7 @@ Pane { Connections { function onNewInviteState() { if (CallManager.haveCallInvite && Settings.mobileMode) { - var component = Qt.createComponent("qrc:/qml/voip/CallInvite.qml"); + var component = Qt.createComponent("qrc:/resources/qml/voip/CallInvite.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot); dialog.open(); diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 7b89eb4b..5528bd98 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -367,6 +367,8 @@ Item { TimelineEffects { id: timelineEffects + shouldEffectsRun: timelineView.shouldEffectsRun + anchors.fill: parent } NhekoDropArea { @@ -416,7 +418,7 @@ Item { effectsTimer.restart(); } function onShowRawMessageDialog(rawMessage) { - var component = Qt.createComponent("qrc:/qml/dialogs/RawMessageDialog.qml"); + var component = Qt.createComponent("qrc:/resources/qml/dialogs/RawMessageDialog.qml"); if (component.status == Component.Ready) { var dialog = component.createObject(timelineRoot, { "rawMessage": rawMessage diff --git a/resources/qml/ui/TimelineEffects.qml b/resources/qml/ui/TimelineEffects.qml index aaff04a0..72237e31 100644 --- a/resources/qml/ui/TimelineEffects.qml +++ b/resources/qml/ui/TimelineEffects.qml @@ -6,34 +6,36 @@ import QtQuick 2.15 import QtQuick.Particles 2.15 Item { + id: effectRoot readonly property int maxLifespan: Math.max(confettiEmitter.lifeSpan, rainfallEmitter.lifeSpan) + required property bool shouldEffectsRun function pulseConfetti() { - confettiEmitter.pulse(parent.height * 2) + confettiEmitter.pulse(effectRoot.height * 2) } function pulseRainfall() { - rainfallEmitter.pulse(parent.height * 3.3) + rainfallEmitter.pulse(effectRoot.height * 3.3) } ParticleSystem { id: particleSystem Component.onCompleted: pause(); - paused: !shouldEffectsRun + paused: !effectRoot.shouldEffectsRun } Emitter { id: confettiEmitter group: "confetti" - width: parent.width * 3/4 + width: effectRoot.width * 3/4 enabled: false - anchors.horizontalCenter: parent.horizontalCenter - y: parent.height - emitRate: Math.min(400 * Math.sqrt(parent.width * parent.height) / 870, 1000) + anchors.horizontalCenter: effectRoot.horizontalCenter + y: effectRoot.height + emitRate: Math.min(400 * Math.sqrt(effectRoot.width * effectRoot.height) / 870, 1000) lifeSpan: 15000 system: particleSystem maximumEmitted: 500 @@ -42,8 +44,8 @@ Item { sizeVariation: 4 velocity: PointDirection { x: 0 - y: -Math.min(450 * parent.height / 700, 1000) - xVariation: Math.min(4 * parent.width / 7, 450) + y: -Math.min(450 * effectRoot.height / 700, 1000) + xVariation: Math.min(4 * effectRoot.width / 7, 450) yVariation: 250 } } @@ -74,7 +76,7 @@ Item { Gravity { system: particleSystem groups: ["confetti"] - anchors.fill: parent + anchors.fill: effectRoot magnitude: 350 angle: 90 } @@ -83,11 +85,11 @@ Item { id: rainfallEmitter group: "rain" - width: parent.width + width: effectRoot.width enabled: false - anchors.horizontalCenter: parent.horizontalCenter + anchors.horizontalCenter: effectRoot.horizontalCenter y: -60 - emitRate: parent.width / 50 + emitRate: effectRoot.width / 50 lifeSpan: 10000 system: particleSystem velocity: PointDirection {