mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-18 17:49:00 +00:00
refactor: revamp profile appearance settings view to align with designs
This commit is contained in:
parent
7a92eaf106
commit
8263a9bec8
@ -6,15 +6,17 @@ import "../../../../imports"
|
|||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/status"
|
import "../../../../shared/status"
|
||||||
|
|
||||||
Item {
|
ScrollView {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width
|
||||||
id: root
|
id: root
|
||||||
Layout.fillHeight: true
|
contentHeight: appearanceContainer.height
|
||||||
Layout.fillWidth: true
|
clip: true
|
||||||
|
|
||||||
enum Theme {
|
enum Theme {
|
||||||
System, // 0
|
Light,
|
||||||
Light, // 1
|
Dark,
|
||||||
Dark // 2
|
System
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTheme(theme) {
|
function updateTheme(theme) {
|
||||||
@ -28,85 +30,136 @@ Item {
|
|||||||
Style.changeTheme(themeStr)
|
Style.changeTheme(themeStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
Item {
|
||||||
id: title
|
id: appearanceContainer
|
||||||
//% "Appearance setting"
|
anchors.right: parent.right
|
||||||
text: qsTrId("appearance-setting")
|
anchors.rightMargin: contentMargin
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 24
|
anchors.leftMargin: contentMargin
|
||||||
anchors.top: parent.top
|
height: this.childrenRect.height + 100
|
||||||
anchors.topMargin: 24
|
|
||||||
font.weight: Font.Bold
|
|
||||||
font.pixelSize: 20
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
ButtonGroup {
|
||||||
id: themeSetting
|
id: chatModeSetting
|
||||||
anchors.top: title.bottom
|
|
||||||
anchors.topMargin: 20
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 24
|
|
||||||
StyledText {
|
|
||||||
//% "Theme (Light - Dark)"
|
|
||||||
text: qsTrId("theme-(light---dark)")
|
|
||||||
}
|
}
|
||||||
ButtonGroup { id: appearance }
|
|
||||||
|
|
||||||
StatusRadioButton {
|
ButtonGroup {
|
||||||
checked: profileModel.profile.appearance === AppearanceContainer.Theme.System
|
id: appearanceSetting
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
ButtonGroup.group: appearance
|
|
||||||
rightPadding: 15
|
|
||||||
text: qsTr("System")
|
|
||||||
onClicked: {
|
|
||||||
root.updateTheme(AppearanceContainer.Theme.System)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
StatusRadioButton {
|
|
||||||
checked: profileModel.profile.appearance === AppearanceContainer.Theme.Light
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
ButtonGroup.group: appearance
|
|
||||||
rightPadding: 15
|
|
||||||
text: qsTr("Light")
|
|
||||||
onClicked: {
|
|
||||||
root.updateTheme(AppearanceContainer.Theme.Light)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StatusRadioButton {
|
|
||||||
checked: profileModel.profile.appearance === AppearanceContainer.Theme.Dark
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
ButtonGroup.group: appearance
|
|
||||||
rightPadding: 0
|
|
||||||
text: qsTr("Dark")
|
|
||||||
onClicked: {
|
|
||||||
root.updateTheme(AppearanceContainer.Theme.Dark)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// For the case where the theme was finally loaded by status-go in init(),
|
|
||||||
// update the theme in qml
|
|
||||||
Connections {
|
|
||||||
target: profileModel
|
|
||||||
onProfileChanged: {
|
|
||||||
root.updateTheme(profileModel.profile.appearance)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
StatusSectionHeadline {
|
||||||
property bool isCompactMode: appSettings.compactMode
|
id: sectionHeadlineChatMode
|
||||||
id: compactModeSetting
|
text: qsTr("Chat mode")
|
||||||
anchors.top: themeSetting.bottom
|
anchors.top: parent.top
|
||||||
anchors.topMargin: 20
|
anchors.left: parent.left
|
||||||
anchors.left: parent.left
|
anchors.right: parent.right
|
||||||
anchors.leftMargin: 24
|
|
||||||
StyledText {
|
|
||||||
//% "Chat Compact Mode"
|
|
||||||
text: qsTrId("chat-compact-mode")
|
|
||||||
}
|
}
|
||||||
Switch {
|
|
||||||
checked: compactModeSetting.isCompactMode
|
RowLayout {
|
||||||
onToggled: function() {
|
id: chatModeSection
|
||||||
appSettings.compactMode = !compactModeSetting.isCompactMode
|
anchors.top: sectionHeadlineChatMode.bottom
|
||||||
|
anchors.topMargin: Style.current.padding
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: -Style.current.padding
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: -Style.current.padding
|
||||||
|
|
||||||
|
StatusImageRadioButton {
|
||||||
|
padding: Style.current.padding
|
||||||
|
image.source: "../../../img/appearance-normal-light.svg"
|
||||||
|
image.height: 186
|
||||||
|
control.text: qsTr("Normal")
|
||||||
|
control.checked: !appSettings.compactMode
|
||||||
|
control.onCheckedChanged: {
|
||||||
|
if (control.checked) {
|
||||||
|
appSettings.compactMode = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusImageRadioButton {
|
||||||
|
padding: Style.current.padding
|
||||||
|
image.source: "../../../img/appearance-compact-light.svg"
|
||||||
|
image.height: 186
|
||||||
|
control.text: qsTr("Compact")
|
||||||
|
control.checked: appSettings.compactMode
|
||||||
|
control.onCheckedChanged: {
|
||||||
|
if (control.checked) {
|
||||||
|
appSettings.compactMode = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusSectionHeadline {
|
||||||
|
id: sectionHeadlineAppearance
|
||||||
|
text: qsTr("Appearance")
|
||||||
|
anchors.top: chatModeSection.bottom
|
||||||
|
anchors.topMargin: Style.current.padding*3
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: appearanceSection
|
||||||
|
anchors.top: sectionHeadlineAppearance.bottom
|
||||||
|
anchors.topMargin: Style.current.padding
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: -Style.current.padding
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: -Style.current.padding
|
||||||
|
|
||||||
|
StatusImageRadioButton {
|
||||||
|
padding: Style.current.smallPadding
|
||||||
|
width: 208
|
||||||
|
height: 184
|
||||||
|
image.source: "../../../img/appearance-normal-light.svg"
|
||||||
|
image.height: 128
|
||||||
|
control.text: qsTr("Light")
|
||||||
|
control.checked: profileModel.profile.appearance === AppearanceContainer.Theme.Light
|
||||||
|
control.onClicked: {
|
||||||
|
if (control.checked) {
|
||||||
|
root.updateTheme(AppearanceContainer.Theme.Light)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusImageRadioButton {
|
||||||
|
padding: Style.current.smallPadding
|
||||||
|
width: 208
|
||||||
|
height: 184
|
||||||
|
image.source: "../../../img/appearance-normal-dark.svg"
|
||||||
|
image.height: 128
|
||||||
|
control.text: qsTr("Dark")
|
||||||
|
control.checked: profileModel.profile.appearance === AppearanceContainer.Theme.Dark
|
||||||
|
control.onClicked: {
|
||||||
|
if (control.checked) {
|
||||||
|
root.updateTheme(AppearanceContainer.Theme.Dark)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusImageRadioButton {
|
||||||
|
padding: Style.current.smallPadding
|
||||||
|
width: 208
|
||||||
|
height: 184
|
||||||
|
image.source: "../../../img/appearance-normal-system.png"
|
||||||
|
image.height: 128
|
||||||
|
control.text: qsTr("System")
|
||||||
|
control.checked: profileModel.profile.appearance === AppearanceContainer.Theme.System
|
||||||
|
control.onClicked: {
|
||||||
|
if (control.checked) {
|
||||||
|
root.updateTheme(AppearanceContainer.Theme.System)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For the case where the theme was finally loaded by status-go in init(),
|
||||||
|
// update the theme in qml
|
||||||
|
Connections {
|
||||||
|
target: profileModel
|
||||||
|
onProfileChanged: {
|
||||||
|
root.updateTheme(profileModel.profile.appearance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
59
ui/app/img/appearance-compact-light.svg
Normal file
59
ui/app/img/appearance-compact-light.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 794 KiB |
58
ui/app/img/appearance-normal-dark.svg
Normal file
58
ui/app/img/appearance-normal-dark.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 794 KiB |
60
ui/app/img/appearance-normal-light.svg
Normal file
60
ui/app/img/appearance-normal-light.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 796 KiB |
BIN
ui/app/img/appearance-normal-system.png
Normal file
BIN
ui/app/img/appearance-normal-system.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
116
ui/app/img/appearance-normal-system.svg
Normal file
116
ui/app/img/appearance-normal-system.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 799 KiB |
Loading…
x
Reference in New Issue
Block a user