From 5bafb2bb5a902961ef02fda63b2d79b6f98c5837 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Wed, 29 Dec 2021 11:32:43 +0100 Subject: [PATCH] refactor(@desktop/settings-appearance): appearance settings updated --- ui/app/AppLayouts/Profile/ProfileLayout.qml | 3 +-- .../Profile/stores/AppearanceStore.qml | 14 +++++++++++++ .../AppLayouts/Profile/stores/RootStore.qml | 11 +++------- .../Profile/views/AppearanceView.qml | 21 +++++++++++-------- ui/imports/shared/views/chat/MessageView.qml | 2 +- 5 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 ui/app/AppLayouts/Profile/stores/AppearanceStore.qml diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index c445e5ca64..1df8d8664f 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -67,8 +67,7 @@ StatusAppTwoPanelLayout { } AppearanceView { - store: profileView.store - globalStore: profileView.globalStore + appearanceStore: profileView.store.appearanceStore profileContentWidth: _internal.profileContentWidth systemPalette: profileView.systemPalette } diff --git a/ui/app/AppLayouts/Profile/stores/AppearanceStore.qml b/ui/app/AppLayouts/Profile/stores/AppearanceStore.qml new file mode 100644 index 0000000000..24d88aedfc --- /dev/null +++ b/ui/app/AppLayouts/Profile/stores/AppearanceStore.qml @@ -0,0 +1,14 @@ +import QtQuick 2.13 +import utils 1.0 + +QtObject { + id: root + + function readTextFile(path) { + return globalUtils.readTextFile(path) + } + + function writeTextFile(path, value) { + globalUtils.writeTextFile(path, value) + } +} diff --git a/ui/app/AppLayouts/Profile/stores/RootStore.qml b/ui/app/AppLayouts/Profile/stores/RootStore.qml index cc0be3a0e4..dc348347f9 100644 --- a/ui/app/AppLayouts/Profile/stores/RootStore.qml +++ b/ui/app/AppLayouts/Profile/stores/RootStore.qml @@ -31,6 +31,9 @@ QtObject { languageModule: profileModuleInst.languageModule } + property AppearanceStore appearanceStore: AppearanceStore { + } + // Not Refactored Yet // property var chatsModelInst: chatsModel // Not Refactored Yet @@ -347,14 +350,6 @@ QtObject { // return profileModelInst.ens.setPubKey(username, address, gasLimit, gasPrice, password) } - function readTextFile(path) { - return globalUtils.readTextFile(path) - } - - function writeTextFile(path, value) { - globalUtils.writeTextFile(path, value) - } - function setMessagesFromContactsOnly(checked) { // Not Refactored Yet // profileModelInst.setMessagesFromContactsOnly(checked) diff --git a/ui/app/AppLayouts/Profile/views/AppearanceView.qml b/ui/app/AppLayouts/Profile/views/AppearanceView.qml index f579fd44ab..a1fd5e21a7 100644 --- a/ui/app/AppLayouts/Profile/views/AppearanceView.qml +++ b/ui/app/AppLayouts/Profile/views/AppearanceView.qml @@ -17,10 +17,14 @@ import "../popups" ScrollView { id: appearanceView + height: parent.height + width: parent.width + contentHeight: appearanceContainer.height + clip: true + + property var appearanceStore property var systemPalette - property var store - property var globalStore property int profileContentWidth enum Theme { @@ -38,10 +42,9 @@ ScrollView { Style.changeFontSize(fontSize) } - height: parent.height - width: parent.width - contentHeight: appearanceContainer.height - clip: true + Component.onCompleted: { + appearanceView.updateFontSize(localAccountSensitiveSettings.fontSize) + } Item { id: appearanceContainer @@ -88,7 +91,7 @@ ScrollView { anchors.leftMargin: Style.current.smallPadding isMessage: true shouldRepeatHeader: true - messageStore: appearanceView.globalStore.messageStore + messageTimestamp:Date.now() senderDisplayName: "@vitalik" senderIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAb0lEQVR4Ae3UQQqAIBRF0Wj9ba9Bq6l5JBQqfn/ngDMH3YS3AAB/tO3H+XRG3b9bR/+gVoREI2RapVXpfd5+X5oXERKNkHS+rk3tOpWkeREh0QiZVu91ql2zNC8iJBoh0yqtSqt1slpCghICANDPBc0ESPh0bHkHAAAAAElFTkSuQmCC" //% "Blockchains will drop search costs, causing a kind of decomposition that allows you to have markets of entities that are horizontally segregated and vertically segregated." @@ -210,7 +213,7 @@ ScrollView { StatusQ.StatusSlider { id: zoomSlider readonly property int initialValue: { - let scaleFactorStr = appearanceView.store.readTextFile(uiScaleFilePath) + let scaleFactorStr = appearanceView.appearanceStore.readTextFile(uiScaleFilePath) if (scaleFactorStr === "") { return 100 } @@ -230,7 +233,7 @@ ScrollView { value: initialValue onValueChanged: { if (value !== initialValue) { - appearanceView.store.writeTextFile(uiScaleFilePath, value / 100.0) + appearanceView.appearanceStore.writeTextFile(uiScaleFilePath, value / 100.0) } } onPressedChanged: { diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 26e952713b..bd83837db5 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -33,7 +33,7 @@ Column { property string messageOutgoingStatus: "" property int messageContentType: 1 property bool pinnedMessage: false - property var reactionsModel + property var reactionsModel: [] property int prevMessageIndex: -1 property var prevMessageAsJsonObj