Standardize spacings

This commit is contained in:
miruka 2019-07-16 05:29:47 -04:00
parent d302a5cf5f
commit d2dfafb4e7
17 changed files with 35 additions and 44 deletions

View File

@ -1,7 +1,5 @@
- Use childrenRect stuff - Use childrenRect stuff
- Account delegate name color
- If avatar is set, name color from average color? - If avatar is set, name color from average color?
- normalSpacing in Theme
- banner button repair - banner button repair
- Wrong avatar for group rooms - Wrong avatar for group rooms
- Make sure to not cache user images and that sourceSize is set everywhere - Make sure to not cache user images and that sourceSize is set everywhere

View File

@ -5,7 +5,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
Column { Column {
spacing: 4 spacing: theme.spacing / 2
property alias label: fieldLabel property alias label: fieldLabel
property alias field: textField property alias field: textField

View File

@ -17,11 +17,11 @@ HRowLayout {
id: noticeLabel id: noticeLabel
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap wrapMode: Text.Wrap
padding: 3 padding: theme.spacing / 2
leftPadding: 10 leftPadding: theme.spacing
rightPadding: 10 rightPadding: leftPadding
Layout.margins: 10 Layout.margins: theme.spacing
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.maximumWidth: Layout.maximumWidth:
parent.width - Layout.leftMargin - Layout.rightMargin parent.width - Layout.leftMargin - Layout.rightMargin

View File

@ -30,7 +30,7 @@ HBaseButton {
HRowLayout { HRowLayout {
id: contentLayout id: contentLayout
spacing: button.text && iconName ? 8 : 0 spacing: button.text && iconName ? theme.spacing : 0
Component.onCompleted: contentWidth = implicitWidth Component.onCompleted: contentWidth = implicitWidth
HIcon { HIcon {

View File

@ -29,7 +29,7 @@ HRectangle {
dimension: bannerLabel.implicitHeight dimension: bannerLabel.implicitHeight
visible: Boolean(svgName) visible: Boolean(svgName)
Layout.leftMargin: 5 Layout.leftMargin: theme.spacing / 2
} }
HLabel { HLabel {
@ -41,7 +41,7 @@ HRectangle {
bannerRow.width - bannerAvatar.width - bannerButtons.width > 30 bannerRow.width - bannerAvatar.width - bannerButtons.width > 30
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 5 Layout.leftMargin: bannerIcon.Layout.leftMargin
Layout.rightMargin: Layout.leftMargin Layout.rightMargin: Layout.leftMargin
} }

View File

@ -105,7 +105,7 @@ HColumnLayout {
) )
} }
collapsed: width < theme.avatar.size + 8 collapsed: width < theme.avatar.size + theme.spacing
property bool wasSnapped: false property bool wasSnapped: false
property int referenceWidth: roomHeader.buttonsWidth property int referenceWidth: roomHeader.buttonsWidth

View File

@ -20,7 +20,7 @@ HRectangle {
HRowLayout { HRowLayout {
id: row id: row
spacing: 8 spacing: theme.spacing
anchors.fill: parent anchors.fill: parent
HRoomAvatar { HRoomAvatar {

View File

@ -10,9 +10,7 @@ HRectangle {
property bool collapsed: false property bool collapsed: false
property var activeView: null property var activeView: null
property int currentSpacing: collapsed ? 0 : theme.spacing
property int normalSpacing: 8
property int currentSpacing: collapsed ? 0 : normalSpacing
Behavior on currentSpacing { HNumberAnimation {} } Behavior on currentSpacing { HNumberAnimation {} }

View File

@ -8,7 +8,7 @@ import "../../utils.js" as Utils
Row { Row {
id: messageContent id: messageContent
spacing: standardSpacing / 2 spacing: theme.spacing / 2
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
HUserAvatar { HUserAvatar {

View File

@ -55,9 +55,8 @@ Column {
) )
property int standardSpacing: 16 readonly property int horizontalPadding: theme.spacing
property int horizontalPadding: 6 readonly property int verticalPadding: theme.spacing / 2
property int verticalPadding: 4
ListView.onAdd: { ListView.onAdd: {
var nextDelegate = eventList.contentItem.children[index] var nextDelegate = eventList.contentItem.children[index]
@ -68,10 +67,10 @@ Column {
topPadding: topPadding:
isFirstEvent ? 0 : isFirstEvent ? 0 :
dayBreak ? standardSpacing * 2 : dayBreak ? theme.spacing * 4 :
talkBreak ? standardSpacing * 3 : talkBreak ? theme.spacing * 6 :
combine ? standardSpacing / 4 : combine ? theme.spacing / 2 :
standardSpacing theme.spacing * 2
Loader { Loader {
source: dayBreak ? "Daybreak.qml" : "" source: dayBreak ? "Daybreak.qml" : ""

View File

@ -8,8 +8,6 @@ import "../../Base"
HRectangle { HRectangle {
property alias listView: eventList property alias listView: eventList
property int space: 8
color: theme.chat.eventList.background color: theme.chat.eventList.background
HListView { HListView {
@ -28,11 +26,11 @@ HRectangle {
delegate: EventDelegate {} delegate: EventDelegate {}
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: space anchors.leftMargin: theme.spacing
anchors.rightMargin: space anchors.rightMargin: theme.spacing
topMargin: space topMargin: theme.spacing
bottomMargin: space bottomMargin: theme.spacing
verticalLayoutDirection: ListView.BottomToTop verticalLayoutDirection: ListView.BottomToTop
// Keep x scroll pages cached, to limit images having to be // Keep x scroll pages cached, to limit images having to be

View File

@ -16,12 +16,12 @@ HRectangle {
Behavior on implicitHeight { HNumberAnimation {} } Behavior on implicitHeight { HNumberAnimation {} }
HRowLayout { HRowLayout {
spacing: 8 spacing: theme.spacing
anchors.fill: parent anchors.fill: parent
Layout.leftMargin: spacing Layout.leftMargin: spacing
Layout.rightMargin: spacing Layout.rightMargin: spacing
Layout.topMargin: 2 Layout.topMargin: spacing / 4
Layout.bottomMargin: 2 Layout.bottomMargin: spacing / 4
HIcon { HIcon {
id: icon id: icon

View File

@ -12,9 +12,8 @@ Page {
property bool wide: width > 414 + padding * 2 property bool wide: width > 414 + padding * 2
property int avatarPreferredSize: theme.minimumSupportedWidth property int avatarPreferredSize: theme.minimumSupportedWidth
property int normalSpacing: 8
property int currentSpacing: property int currentSpacing:
Math.min(normalSpacing * width / 400, normalSpacing * 2) Math.min(theme.spacing * width / 400, theme.spacing * 2)
property string userId: "" property string userId: ""
readonly property var userInfo: users.find(userId) readonly property var userInfo: users.find(userId)
@ -53,7 +52,7 @@ Page {
background: null background: null
leftPadding: currentSpacing < 8 ? 0 : currentSpacing leftPadding: currentSpacing < theme.spacing ? 0 : currentSpacing
rightPadding: leftPadding rightPadding: leftPadding
Behavior on leftPadding { HNumberAnimation {} } Behavior on leftPadding { HNumberAnimation {} }
@ -67,7 +66,7 @@ Page {
HColumnLayout { HColumnLayout {
id: boxColumn id: boxColumn
spacing: 16 spacing: theme.spacing * 2
width: flickable.width width: flickable.width
height: flickable.height height: flickable.height

View File

@ -71,7 +71,7 @@ HGridLayout {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
} }
Item { Layout.preferredHeight: 8 } Item { Layout.preferredHeight: theme.spacing }
HLabel { HLabel {
text: qsTr("Upload profile picture") text: qsTr("Upload profile picture")
@ -95,10 +95,10 @@ HGridLayout {
HColumnLayout { HColumnLayout {
id: profileInfo id: profileInfo
spacing: normalSpacing spacing: theme.spacing
HColumnLayout { HColumnLayout {
spacing: normalSpacing spacing: theme.spacing
Layout.margins: currentSpacing Layout.margins: currentSpacing
HLabel { HLabel {

View File

@ -12,8 +12,7 @@ HRectangle {
clip: true clip: true
property bool collapsed: false property bool collapsed: false
property int normalSpacing: 8 property int currentSpacing: collapsed ? 0 : theme.spacing
property int currentSpacing: collapsed ? 0 : normalSpacing
Behavior on currentSpacing { HNumberAnimation {} } Behavior on currentSpacing { HNumberAnimation {} }

View File

@ -6,12 +6,12 @@ import QtQuick 2.12
QtObject { QtObject {
id: theme id: theme
property int animationDuration: 100
property int minimumSupportedWidth: 240 property int minimumSupportedWidth: 240
property int minimumSupportedHeight: 120 property int minimumSupportedHeight: 120
property int baseElementsHeight: 36 property int baseElementsHeight: 36
property int spacing: 8
property int animationDuration: 100
property QtObject fontSize: QtObject { property QtObject fontSize: QtObject {
property int smallest: 6 property int smallest: 6

View File

@ -39,7 +39,7 @@ Item {
SidePane { SidePane {
id: sidePane id: sidePane
visible: accountsPresent visible: accountsPresent
collapsed: width < Layout.minimumWidth + normalSpacing collapsed: width < Layout.minimumWidth + theme.spacing
property int parentWidth: parent.width property int parentWidth: parent.width
property int collapseBelow: 120 property int collapseBelow: 120