diff --git a/storybook/main.qml b/storybook/main.qml index 20a8906bcb..c09ae21e5f 100644 --- a/storybook/main.qml +++ b/storybook/main.qml @@ -31,11 +31,6 @@ ApplicationWindow { onCurrentPageChanged: testsReRunTimer.restart() - // We need to set Global.applicationWindow to test components that relies on it e.g. ConfirmChangePasswordModal - Component.onCompleted: { - Global.applicationWindow = this; - } - QtObject { id: d diff --git a/ui/app/AppLayouts/Chat/stores/MessageStore.qml b/ui/app/AppLayouts/Chat/stores/MessageStore.qml index 8999ee31d7..bd2522a6a5 100644 --- a/ui/app/AppLayouts/Chat/stores/MessageStore.qml +++ b/ui/app/AppLayouts/Chat/stores/MessageStore.qml @@ -206,10 +206,7 @@ QtObject { messageModule.addNewMessagesMarker() } - property bool playAnimation: { - if (!Global.applicationWindow.active) - return false - + readonly property bool isChatActive: { if (root.getSectionId() !== mainModule.activeSection.id) return false diff --git a/ui/app/AppLayouts/Communities/helpers/TransactionFeesBroker.qml b/ui/app/AppLayouts/Communities/helpers/TransactionFeesBroker.qml index a292ed4fd8..a71a871ffc 100644 --- a/ui/app/AppLayouts/Communities/helpers/TransactionFeesBroker.qml +++ b/ui/app/AppLayouts/Communities/helpers/TransactionFeesBroker.qml @@ -1,7 +1,6 @@ import QtQuick 2.15 import shared.stores 1.0 -import utils 1.0 import StatusQ.Core.Utils 0.1 @@ -17,6 +16,7 @@ QtObject { } property CommunityTokensStore communityTokensStore + property alias active: feesBroker.active property QtObject d: QtObject { id: internal @@ -122,7 +122,8 @@ QtObject { readonly property Component setSignerFeeSubscriptionComponent: SetSignerFeeSubscription {} readonly property SubscriptionBroker feesBroker: SubscriptionBroker { - active: Global.applicationWindow.active + id: feesBroker + onRequest: internal.computeFee(topic) } diff --git a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml index ccac100a10..b01de82462 100644 --- a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml @@ -1,5 +1,6 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 +import QtQuick.Window 2.15 import QtQuick.Dialogs 1.3 import SortFilterProxyModel 0.2 @@ -594,6 +595,7 @@ StatusSectionLayout { readonly property TransactionFeesBroker feesBroker: TransactionFeesBroker { communityTokensStore: root.rootStore.communityTokensStore + active: root.Window.window.active } function goTo(section: int, subSection: int) { diff --git a/ui/app/AppLayouts/Profile/popups/ConfirmChangePasswordModal.qml b/ui/app/AppLayouts/Profile/popups/ConfirmChangePasswordModal.qml index 71e8a220ee..5899aa1627 100644 --- a/ui/app/AppLayouts/Profile/popups/ConfirmChangePasswordModal.qml +++ b/ui/app/AppLayouts/Profile/popups/ConfirmChangePasswordModal.qml @@ -1,6 +1,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.12 +import QtQuick.Window 2.15 import QtQml.Models 2.15 import QtGraphicalEffects 1.15 @@ -93,9 +94,9 @@ StatusDialog { ShaderEffectSource { id: blurSource - sourceItem: Global.applicationWindow.contentItem - width: Global.applicationWindow.contentItem.width - height: Global.applicationWindow.contentItem.height + sourceItem: Window.window.contentItem + width: Window.window.contentItem.width + height: Window.window.contentItem.height live: false visible: false diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 4edc29b76c..7fd9211f1b 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -1,5 +1,6 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 +import QtQuick.Window 2.15 import QtQuick.Layouts 1.15 import QtMultimedia 5.15 import Qt.labs.platform 1.1 @@ -576,11 +577,13 @@ Item { } Connections { - target: Global.applicationWindow + target: Window.window function onActiveChanged() { - if (Global.applicationWindow.active) appMain.rootStore.windowActivated() - else appMain.rootStore.windowDeactivated() + if (Window.window.active) + appMain.rootStore.windowActivated() + else + appMain.rootStore.windowDeactivated() } } diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index 69fea6f3e5..0d29238e7d 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -1,5 +1,6 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 +import QtQuick.Window 2.15 import QtQuick.Dialogs 1.3 import QtQml.Models 2.15 import QtQml 2.15 @@ -1112,6 +1113,7 @@ QtObject { readonly property TransactionFeesBroker feesBroker: TransactionFeesBroker { communityTokensStore: root.communityTokensStore + active: finalisePopup.contentItem.Window.window.active } chainId: finalisePopup.ownerTokenDetails.chainId diff --git a/ui/imports/shared/MacTrafficLights.qml b/ui/imports/shared/MacTrafficLights.qml index e87463fc7c..4e7eb4a11f 100644 --- a/ui/imports/shared/MacTrafficLights.qml +++ b/ui/imports/shared/MacTrafficLights.qml @@ -1,10 +1,10 @@ -import QtQuick 2.13 - +import QtQuick 2.15 +import QtQuick.Window 2.15 import utils 1.0 MouseArea { - id: statusMacWindowButtons + id: root signal close() signal minimised() @@ -20,6 +20,12 @@ MouseArea { readonly property color inactiveBorder: Style.current.name === Constants.lightThemeName ? "#10000000" : "#10FFFFFF" + QtObject { + id: d + + readonly property bool windowActive: root.Window.window.active + } + Row { id: layout spacing: 8 @@ -30,15 +36,13 @@ MouseArea { radius: width / 2 antialiasing: true - color: closeSensor.pressed ? "#B24F47" : (Global.applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#E9685C", 1.07) - : inactive ) - border.color:closeSensor.pressed ? "#943229" : (Global.applicationWindow.active ? "#D14C40" - : inactiveBorder) + color: closeSensor.pressed ? "#B24F47" : (d.windowActive || root.containsMouse ? Qt.lighter("#E9685C", 1.07) : inactive) + border.color:closeSensor.pressed ? "#943229" : (d.windowActive ? "#D14C40" : inactiveBorder) border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0 Image { anchors.centerIn: parent - visible: statusMacWindowButtons.containsMouse + visible: root.containsMouse source: Style.png("traffic_lights/" + (closeSensor.pressed ? "close_pressed" : "close")) scale: 0.25 } @@ -48,7 +52,7 @@ MouseArea { id: closeSensor anchors.fill: parent - onClicked: statusMacWindowButtons.close() + onClicked: root.close() } } @@ -58,16 +62,14 @@ MouseArea { radius: width / 2 antialiasing: true - color: miniSensor.pressed ? "#878E3B" : (Global.applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#EDB84C", 1.07) - : inactive) - border.color:miniSensor.pressed ? "#986E29" : (Global.applicationWindow.active ? "#D79F3D" - : inactiveBorder) + color: miniSensor.pressed ? "#878E3B" : (d.windowActive || root.containsMouse ? Qt.lighter("#EDB84C", 1.07) : inactive) + border.color:miniSensor.pressed ? "#986E29" : (d.windowActive ? "#D79F3D" : inactiveBorder) border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0 Image { anchors.centerIn: parent anchors.verticalCenterOffset: -0.25 - visible: statusMacWindowButtons.containsMouse + visible: root.containsMouse source: Style.png("traffic_lights/" + (miniSensor.pressed ? "minimise_pressed" : "minimise")) scale: 0.27 } @@ -76,7 +78,7 @@ MouseArea { id: miniSensor anchors.fill: parent - onClicked: statusMacWindowButtons.minimised() + onClicked: root.minimised() } } @@ -86,15 +88,13 @@ MouseArea { radius: width / 2 antialiasing: true - color: maxiSensor.pressed ? "#48943f" : (Global.applicationWindow.active || statusMacWindowButtons.containsMouse ? Qt.lighter("#62C454", 1.06) - : inactive) - border.color: maxiSensor.pressed ? "#357225" : (Global.applicationWindow.active ? "#53A73E" - : inactiveBorder) + color: maxiSensor.pressed ? "#48943f" : (d.windowActive || root.containsMouse ? Qt.lighter("#62C454", 1.06) : inactive) + border.color: maxiSensor.pressed ? "#357225" : (d.windowActive ? "#53A73E" : inactiveBorder) border.width: Style.current.name === Constants.lightThemeName ? 0.5 : 0 Image { anchors.centerIn: parent - visible: statusMacWindowButtons.containsMouse + visible: root.containsMouse source: Style.png("traffic_lights/" + (maxiSensor.pressed ? "maximize_pressed" : "maximize")) scale: 0.25 } @@ -103,7 +103,7 @@ MouseArea { id: maxiSensor anchors.fill: parent - onClicked: statusMacWindowButtons.maximized() + onClicked: root.maximized() } } } diff --git a/ui/imports/shared/popups/SettingsDirtyToastMessage.qml b/ui/imports/shared/popups/SettingsDirtyToastMessage.qml index 49efa7ca90..93f3343d8e 100644 --- a/ui/imports/shared/popups/SettingsDirtyToastMessage.qml +++ b/ui/imports/shared/popups/SettingsDirtyToastMessage.qml @@ -1,5 +1,6 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 +import QtQuick.Window 2.15 import QtGraphicalEffects 1.15 import utils 1.0 @@ -72,7 +73,7 @@ Rectangle { if (!active || !flickable) return; - const item = Global.applicationWindow.activeFocusItem; + const item = Window.window.activeFocusItem; const h1 = this.height; const y1 = this.mapToGlobal(0, 0).y; const h2 = item.height; diff --git a/ui/imports/shared/status/StatusChatImageLoader.qml b/ui/imports/shared/status/StatusChatImageLoader.qml index 455d93b39b..e9563acbbc 100644 --- a/ui/imports/shared/status/StatusChatImageLoader.qml +++ b/ui/imports/shared/status/StatusChatImageLoader.qml @@ -1,10 +1,8 @@ -import QtQuick 2.3 -import QtGraphicalEffects 1.13 -import shared 1.0 +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtGraphicalEffects 1.15 import shared.panels 1.0 -import utils 1.0 - Item { id: root @@ -12,7 +10,8 @@ Item { property int imageWidth: 350 property url source property bool isActiveChannel: false - property bool playing: Global.applicationWindow.active + property bool playing: Window.window.active + property bool isAnimated: !!source && source.toString().endsWith('.gif') property alias imageAlias: imageMessage property bool allCornersRounded: false diff --git a/ui/imports/shared/status/StatusImageModal.qml b/ui/imports/shared/status/StatusImageModal.qml index 71c4f8ae29..b9dd6b5a4c 100644 --- a/ui/imports/shared/status/StatusImageModal.qml +++ b/ui/imports/shared/status/StatusImageModal.qml @@ -1,14 +1,13 @@ -import QtQuick 2.13 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.13 -import QtQuick.Layouts 1.13 -import QtGraphicalEffects 1.13 +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Window 2.15 +import QtQuick.Layouts 1.15 +import QtGraphicalEffects 1.15 import StatusQ.Popups.Dialog 0.1 import StatusQ.Components 0.1 import StatusQ.Core.Theme 0.1 import utils 1.0 -import shared 1.0 import shared.popups 1.0 StatusDialog { @@ -30,8 +29,8 @@ StatusDialog { QtObject { id: d - property int maxHeight: Global.applicationWindow.height - 80 - property int maxWidth: Global.applicationWindow.width - 80 + property int maxHeight: root.contentItem.Window.window.height - 80 + property int maxWidth: root.contentItem.Window.window.width - 80 readonly property int radius: Style.current.radius } diff --git a/ui/imports/shared/status/StatusNotification.qml b/ui/imports/shared/status/StatusNotification.qml deleted file mode 100644 index 3c149b686e..0000000000 --- a/ui/imports/shared/status/StatusNotification.qml +++ /dev/null @@ -1,115 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 -import QtGraphicalEffects 1.13 - -import utils 1.0 -import shared 1.0 -import shared.panels 1.0 - -import StatusQ.Components 0.1 -import StatusQ.Core.Theme 0.1 -import StatusQ.Core 0.1 - -Rectangle { - id: root - property string chatId: "" - property string name: "channelName" - property string message: "My latest message\n with a return" - property int chatType: Constants.chatType.unknown - - color: "#F7F7F7" - width: 366 - height: 75 - - anchors.top: Global.applicationWindow.top - radius: Style.current.radius - - Loader { - id: identicon - sourceComponent: localAccountSensitiveSettings.notificationMessagePreviewSetting === Constants.settingsSection.notificationsBubble.previewAnonymous ? statusIdenticon : userOrChannelIdenticon - anchors.left: parent.left - anchors.leftMargin: Style.current.padding - anchors.verticalCenter: parent.verticalCenter - height: 40 - width: 40 - } - - Component { - id: userOrChannelIdenticon - StatusSmartIdenticon { - id: contactImage - anchors.left: parent.left - anchors.leftMargin: Style.current.smallPadding - anchors.verticalCenter: parent.verticalCenter - asset.width: 40 - asset.height: 40 - asset.letterSize: 15 - asset.color: Theme.palette.miscColor5 - name: root.name - } - } - - Component { - id: statusIdenticon - SVGImage { - source: Style.png("status-logo-icon") - width: 40 - height: 40 - } - } - - StyledText { - id: name - anchors.bottom: messagePreview.top - anchors.bottomMargin: 2 - anchors.left: identicon.right - anchors.leftMargin: Style.current.smallPadding - anchors.right: openButton.left - anchors.rightMargin: Style.current.smallPadding - elide: Text.ElideRight - text: root.name - font.weight: Font.Medium - font.pixelSize: 15 - color: Style.current.evenDarkerGrey - } - - StyledText { - id: messagePreview - anchors.bottom: identicon.bottom - anchors.bottomMargin: 2 - anchors.left: identicon.right - anchors.leftMargin: Style.current.smallPadding - anchors.right: openButton.left - anchors.rightMargin: Style.current.padding - elide: Text.ElideRight - clip: true // This is needed because emojis don't ellide correctly - font.pixelSize: 14 - color: Style.current.evenDarkerGrey - text: root.message - } - - Rectangle { - id: openButton - anchors.right: parent.right - height: parent.height - width: 85 - color: "transparent" - - Rectangle { - height: parent.height - width: 1.2 - anchors.left: parent.left - color: "#D9D9D9" - } - - StyledText { - font.weight: Font.Medium - font.pixelSize: 14 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Open") - color: Style.current.darkerGrey - } - } -} - diff --git a/ui/imports/shared/status/StatusVideoModal.qml b/ui/imports/shared/status/StatusVideoModal.qml index d77296b169..6d3183e2cd 100644 --- a/ui/imports/shared/status/StatusVideoModal.qml +++ b/ui/imports/shared/status/StatusVideoModal.qml @@ -1,5 +1,6 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 +import QtQuick.Window 2.15 import QtMultimedia 5.15 import StatusQ.Popups.Dialog 0.1 @@ -24,8 +25,8 @@ StatusDialog { QtObject { id: d - readonly property int maxHeight: Global.applicationWindow.height - 80 - readonly property int maxWidth: Global.applicationWindow.width - 80 + readonly property int maxHeight: root.contentItem.Window.window.height - 80 + readonly property int maxWidth: root.contentItem.Window.window.width - 80 } onOpened: { diff --git a/ui/imports/shared/status/qmldir b/ui/imports/shared/status/qmldir index 46023230e1..a54a2ca95b 100644 --- a/ui/imports/shared/status/qmldir +++ b/ui/imports/shared/status/qmldir @@ -16,7 +16,6 @@ StatusImageModal 1.0 StatusImageModal.qml StatusVideoModal 1.0 StatusVideoModal.qml StatusImageRadioButton 1.0 StatusImageRadioButton.qml StatusInputListPopup 1.0 StatusInputListPopup.qml -StatusNotification 1.0 StatusNotification.qml StatusSearchListPopup 1.0 StatusSearchListPopup.qml StatusSectionHeadline 1.0 StatusSectionHeadline.qml StatusSettingsLineButton 1.0 StatusSettingsLineButton.qml diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 451aca3875..20bbb61954 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -1,5 +1,6 @@ -import QtQuick 2.14 -import QtQuick.Layouts 1.14 +import QtQuick 2.15 +import QtQuick.Window 2.15 +import QtQuick.Layouts 1.15 import utils 1.0 import shared.panels 1.0 @@ -950,9 +951,10 @@ Loader { linksComponent: Component { LinksMessageView { id: linksMessageView + linkPreviewModel: root.linkPreviewModel gifLinks: root.gifLinks - playAnimations: root.messageStore.playAnimation + playAnimations: Window.window.active && root.messageStore.isChatActive isOnline: root.rootStore.mainModuleInst.isOnline highlightLink: delegate.hoveredLink onImageClicked: (image, mouse, imageSource, url) => { diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index 857824b06c..d879447346 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -6,7 +6,6 @@ QtObject { id: root property var dragArea - property var applicationWindow property bool activityPopupOpened: false property int settingsSubsection: Constants.settingsSubsection.profile property int settingsSubSubsection: -1 diff --git a/ui/main.qml b/ui/main.qml index 29225d2798..74fa441f30 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -283,7 +283,6 @@ StatusWindow { } Component.onCompleted: { - Global.applicationWindow = this; Style.changeTheme(Universal.System, systemPalette.isCurrentSystemThemeDark()); restoreAppState();