mirror of https://github.com/cutefishos/settings
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
180 lines
5.4 KiB
QML
180 lines
5.4 KiB
QML
import QtQuick 2.12
|
|
import QtQuick.Controls 2.12
|
|
import QtQuick.Layouts 1.12
|
|
import QtQuick.Dialogs 1.2
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import Cutefish.Settings 1.0
|
|
import Cutefish.Accounts 1.0
|
|
import FishUI 1.0 as FishUI
|
|
|
|
import "../"
|
|
|
|
Item {
|
|
id: control
|
|
|
|
height: mainLayout.implicitHeight
|
|
|
|
UserAccount {
|
|
id: currentUser
|
|
userId: model.userId
|
|
}
|
|
|
|
FileDialog {
|
|
id: fileDialog
|
|
folder: shortcuts.pictures
|
|
nameFilters: ["Image files (*.jpg *.png)", "All files (*)"]
|
|
onAccepted: {
|
|
currentUser.iconFileName = fileDialog.fileUrl.toString().replace("file://", "")
|
|
_userImage.source = fileDialog.fileUrl
|
|
_userImage.update()
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
id: mainLayout
|
|
anchors.fill: parent
|
|
spacing: 0
|
|
|
|
RowLayout {
|
|
id: _itemLayout
|
|
spacing: 0
|
|
|
|
Item {
|
|
id: _topItem
|
|
|
|
Layout.fillWidth: true
|
|
height: _topLayout.implicitHeight
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onDoubleClicked: additionalSettings.toggle()
|
|
}
|
|
|
|
RowLayout {
|
|
id: _topLayout
|
|
anchors.fill: parent
|
|
|
|
Image {
|
|
id: _userImage
|
|
width: 50
|
|
height: 50
|
|
sourceSize: Qt.size(width, height)
|
|
source: iconFileName ? "file:///" + iconFileName : "image://icontheme/default-user"
|
|
visible: status === Image.Ready
|
|
|
|
layer.enabled: true
|
|
layer.effect: OpacityMask {
|
|
maskSource: Item {
|
|
width: _userImage.width
|
|
height: width
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
radius: width / 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Label {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
text: userName
|
|
font.pointSize: 16
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
leftPadding: FishUI.Units.largeSpacing
|
|
}
|
|
|
|
Label {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
text: realName
|
|
color: FishUI.Theme.disabledTextColor
|
|
visible: realName !== userName
|
|
font.pointSize: 16
|
|
bottomPadding: FishUI.Units.smallSpacing
|
|
}
|
|
|
|
Item {
|
|
Layout.fillWidth: true
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Currently logged")
|
|
visible: currentUser.userId === loggedUser.userId
|
|
}
|
|
|
|
Button {
|
|
onClicked: additionalSettings.toggle()
|
|
|
|
implicitWidth: height
|
|
|
|
background: Item {}
|
|
|
|
Image {
|
|
anchors.centerIn: parent
|
|
width: 22
|
|
height: 22
|
|
sourceSize: Qt.size(width, height)
|
|
source: FishUI.Theme.darkMode ? additionalSettings.shown ? "qrc:/images/dark/up.svg" : "qrc:/images/dark/down.svg"
|
|
: additionalSettings.shown ? "qrc:/images/light/up.svg" : "qrc:/images/light/down.svg"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Item {
|
|
height: FishUI.Units.largeSpacing
|
|
}
|
|
|
|
Hideable {
|
|
id: additionalSettings
|
|
|
|
GridLayout {
|
|
Layout.fillWidth: true
|
|
Layout.bottomMargin: FishUI.Units.smallSpacing
|
|
rowSpacing: FishUI.Units.largeSpacing
|
|
columns: 2
|
|
|
|
Label {
|
|
text: qsTr("Avatar")
|
|
Layout.fillWidth: true
|
|
}
|
|
|
|
Button {
|
|
text: qsTr("Choose")
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
onClicked: fileDialog.open()
|
|
}
|
|
|
|
Label {
|
|
text: qsTr("Automatic login")
|
|
Layout.fillWidth: true
|
|
}
|
|
|
|
Switch {
|
|
id: automaticLoginSwitch
|
|
Layout.fillHeight: true
|
|
leftPadding: 0
|
|
rightPadding: 0
|
|
onCheckedChanged: currentUser.automaticLogin = checked
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
|
|
Component.onCompleted: {
|
|
automaticLoginSwitch.checked = currentUser.automaticLogin
|
|
}
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: qsTr("Delete this user")
|
|
enabled: model.userId !== loggedUser.userId
|
|
onClicked: accountsManager.deleteUser(userId, true)
|
|
}
|
|
|
|
HorizontalDivider {}
|
|
}
|
|
}
|
|
}
|