Adjust some details

pull/26/head
reionwong 4 years ago
parent e36b461d96
commit c52d919f1f

@ -25,12 +25,10 @@ Button {
id: control
property color backgroundColor: FishUI.Theme.darkMode ? "#363636" : "#FFFFFF"
property color hoveredColor: Qt.tint(FishUI.Theme.textColor, Qt.rgba(backgroundColor.r,
backgroundColor.g,
backgroundColor.b, 0.9))
property color pressedColor: Qt.tint(FishUI.Theme.textColor, Qt.rgba(backgroundColor.r,
backgroundColor.g,
backgroundColor.b, 0.8))
property color hoveredColor: FishUI.Theme.darkMode ? Qt.lighter(backgroundColor, 1.3)
: Qt.darker(backgroundColor, 1.1)
property color pressedColor: FishUI.Theme.darkMode ? Qt.lighter(backgroundColor, 1.1)
: Qt.darker(backgroundColor, 1.2)
background: Rectangle {
radius: FishUI.Theme.mediumRadius

@ -63,7 +63,7 @@ RoundedItem {
id: _topItem
Layout.fillWidth: true
height: _topLayout.implicitHeight
height: _topLayout.implicitHeight + FishUI.Units.largeSpacing
MouseArea {
anchors.fill: parent
@ -73,6 +73,8 @@ RoundedItem {
RowLayout {
id: _topLayout
anchors.fill: parent
anchors.topMargin: FishUI.Units.smallSpacing
anchors.bottomMargin: FishUI.Units.smallSpacing
Image {
id: _userImage
@ -142,7 +144,7 @@ RoundedItem {
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"
: additionalSettings.shown ? "qrc:/images/light/up.svg" : "qrc:/images/light/down.svg"
}
}
}
@ -181,12 +183,7 @@ RoundedItem {
}
}
Button {
text:"修改密码"
Layout.fillWidth: true
}
Button {
StandardButton {
text: qsTr("Delete this user")
enabled: model.userId !== loggedUser.userId
onClicked: accountsManager.deleteUser(userId, true)

@ -40,7 +40,6 @@ ItemPage {
ColumnLayout {
id: layout
anchors.fill: parent
anchors.topMargin: FishUI.Units.smallSpacing
spacing: FishUI.Units.largeSpacing
RoundedItem {
@ -55,11 +54,6 @@ ItemPage {
TabBar {
Layout.fillWidth: true
background: Rectangle {
color: FishUI.Theme.darkMode ? "#4A4A4D" : "#E5E5EB"
radius: FishUI.Theme.mediumRadius
}
onCurrentIndexChanged: {
background.backgroundType = currentIndex
}
@ -77,151 +71,160 @@ ItemPage {
}
}
}
}
// DesktopPreview {
// Layout.alignment: Qt.AlignHCenter
// width: 500
// height: 300
// }
GridView {
id: _view
GridView {
id: _view
property int rowCount: _view.width / itemWidth
property int rowCount: _view.width / itemWidth
Layout.fillWidth: true
implicitHeight: Math.ceil(_view.count / rowCount) * cellHeight + FishUI.Units.largeSpacing
Layout.fillWidth: true
implicitHeight: Math.ceil(_view.count / rowCount) * cellHeight + FishUI.Units.largeSpacing
visible: background.backgroundType === 0
visible: background.backgroundType === 0
clip: true
model: background.backgrounds
currentIndex: -1
interactive: false
clip: true
model: background.backgrounds
currentIndex: -1
interactive: false
cellHeight: itemHeight
cellWidth: calcExtraSpacing(itemWidth, _view.width) + itemWidth
cellHeight: itemHeight
cellWidth: calcExtraSpacing(itemWidth, _view.width) + itemWidth
property int itemWidth: 250
property int itemHeight: 170
property int itemWidth: 250
property int itemHeight: 170
delegate: Item {
id: item
delegate: Item {
id: item
property bool isSelected: modelData === background.currentBackgroundPath
property bool isSelected: modelData === background.currentBackgroundPath
width: GridView.view.cellWidth
height: GridView.view.cellHeight
scale: 1.0
width: GridView.view.cellWidth
height: GridView.view.cellHeight
scale: 1.0
Behavior on scale {
NumberAnimation {
duration: 100
Behavior on scale {
NumberAnimation {
duration: 100
}
}
}
// Preload background
Rectangle {
anchors.fill: parent
anchors.margins: FishUI.Units.largeSpacing
radius: FishUI.Theme.bigRadius + FishUI.Units.smallSpacing / 2
color: FishUI.Theme.backgroundColor
visible: _image.status !== Image.Ready
}
// Preload image
Image {
anchors.centerIn: parent
width: 64
height: width
sourceSize: Qt.size(width, height)
source: FishUI.Theme.darkMode ? "qrc:/images/dark/picture.svg"
: "qrc:/images/light/picture.svg"
visible: _image.status !== Image.Ready
}
Rectangle {
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
color: "transparent"
radius: FishUI.Theme.bigRadius + FishUI.Units.smallSpacing / 2
border.color: FishUI.Theme.highlightColor
border.width: _image.status == Image.Ready & isSelected ? 3 : 0
// Preload background
Rectangle {
anchors.fill: parent
anchors.margins: FishUI.Units.largeSpacing
radius: FishUI.Theme.bigRadius + FishUI.Units.smallSpacing / 2
color: FishUI.Theme.backgroundColor
visible: _image.status !== Image.Ready
}
// Preload image
Image {
id: _image
anchors.centerIn: parent
width: 64
height: width
sourceSize: Qt.size(width, height)
source: FishUI.Theme.darkMode ? "qrc:/images/dark/picture.svg"
: "qrc:/images/light/picture.svg"
visible: _image.status !== Image.Ready
}
Rectangle {
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
source: "file://" + modelData
sourceSize: Qt.size(width, height)
fillMode: Image.PreserveAspectCrop
asynchronous: true
mipmap: true
cache: true
smooth: true
opacity: 1.0
Behavior on opacity {
NumberAnimation {
duration: 100
easing.type: Easing.InOutCubic
color: "transparent"
radius: FishUI.Theme.bigRadius + FishUI.Units.smallSpacing / 2
border.color: FishUI.Theme.highlightColor
border.width: _image.status == Image.Ready & isSelected ? 3 : 0
Image {
id: _image
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
source: "file://" + modelData
sourceSize: Qt.size(width, height)
fillMode: Image.PreserveAspectCrop
asynchronous: true
mipmap: true
cache: true
smooth: true
opacity: 1.0
Behavior on opacity {
NumberAnimation {
duration: 100
easing.type: Easing.InOutCubic
}
}
}
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: _image.width
height: _image.height
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Item {
width: _image.width
height: _image.height
Rectangle {
anchors.fill: parent
radius: FishUI.Theme.bigRadius
Rectangle {
anchors.fill: parent
radius: FishUI.Theme.bigRadius
}
}
}
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
hoverEnabled: true
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
hoverEnabled: true
onClicked: {
background.setBackground(modelData)
}
onClicked: {
background.setBackground(modelData)
}
onEntered: function() {
_image.opacity = 0.7
}
onExited: function() {
_image.opacity = 1.0
onEntered: function() {
_image.opacity = 0.7
}
onExited: function() {
_image.opacity = 1.0
}
onPressedChanged: item.scale = pressed ? 0.97 : 1.0
}
}
}
onPressedChanged: item.scale = pressed ? 0.97 : 1.0
function calcExtraSpacing(cellSize, containerSize) {
var availableColumns = Math.floor(containerSize / cellSize)
var extraSpacing = 0
if (availableColumns > 0) {
var allColumnSize = availableColumns * cellSize
var extraSpace = Math.max(containerSize - allColumnSize, 0)
extraSpacing = extraSpace / availableColumns
}
return Math.floor(extraSpacing)
}
}
function calcExtraSpacing(cellSize, containerSize) {
var availableColumns = Math.floor(containerSize / cellSize)
var extraSpacing = 0
if (availableColumns > 0) {
var allColumnSize = availableColumns * cellSize
var extraSpace = Math.max(containerSize - allColumnSize, 0)
extraSpacing = extraSpace / availableColumns
}
return Math.floor(extraSpacing)
Item {
visible: background.backgroundType === 1
height: FishUI.Units.smallSpacing
}
Loader {
Layout.fillWidth: true
height: item.height
visible: background.backgroundType === 1
sourceComponent: colorView
}
}
Loader {
Layout.fillWidth: true
height: item.height
visible: background.backgroundType === 1
sourceComponent: colorView
// DesktopPreview {
// Layout.alignment: Qt.AlignHCenter
// width: 500
// height: 300
// }
Item {
height: FishUI.Units.largeSpacing
}
}
}
@ -232,7 +235,10 @@ ItemPage {
GridView {
id: _colorView
Layout.fillWidth: true
height: _colorView.count * cellHeight
property int rowCount: _colorView.width / cellWidth
implicitHeight: Math.ceil(_colorView.count / _colorView.rowCount) * cellHeight + FishUI.Units.largeSpacing
cellWidth: 50
cellHeight: 50

Loading…
Cancel
Save