chore: applicationWindow property removed from Global singleton

Closes: #16455
This commit is contained in:
Michał Cieślak 2024-10-04 13:01:08 +02:00 committed by Michał
parent ffc5da3805
commit 9503def18b
17 changed files with 61 additions and 176 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
}

View File

@ -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) {

View File

@ -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

View File

@ -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()
}
}

View File

@ -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

View File

@ -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()
}
}
}

View File

@ -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;

View File

@ -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

View File

@ -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
}

View File

@ -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
}
}
}

View File

@ -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: {

View File

@ -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

View File

@ -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) => {

View File

@ -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

View File

@ -283,7 +283,6 @@ StatusWindow {
}
Component.onCompleted: {
Global.applicationWindow = this;
Style.changeTheme(Universal.System, systemPalette.isCurrentSystemThemeDark());
restoreAppState();