Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad custom button alignments, sizings, etc. #5189

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/gui/tray/ActivityActionButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ AbstractButton {
property string verb: ""
property bool isTalkReplyButton: false

leftPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing
rightPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing

background: NCButtonBackground {
color: Style.currentUserHeaderColor
Expand Down
2 changes: 1 addition & 1 deletion src/gui/tray/ActivityItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ItemDelegate {

Layout.fillWidth: true
Layout.leftMargin: Style.trayListItemIconSize + activityContent.spacing
Layout.minimumHeight: Style.minActivityHeight
Layout.preferredHeight: Style.standardPrimaryButtonHeight

displayActions: model.displayActions
objectType: model.objectType
Expand Down
4 changes: 2 additions & 2 deletions src/gui/tray/CustomButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Button {
hovered: root.hovered
}

leftPadding: root.text === "" ? 5 : 10
rightPadding: root.text === "" ? 5 : 10
leftPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing
rightPadding: root.text === "" ? Style.smallSpacing : Style.standardSpacing
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding

NCToolTip {
Expand Down
10 changes: 6 additions & 4 deletions src/gui/tray/NCButtonContents.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@ RowLayout {
Image {
id: icon

Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.fillWidth: !buttonLabel.visible

source: root.hovered ? root.imageSourceHover : root.imageSource
fillMode: Image.PreserveAspectFit
horizontalAlignment: Image.AlignHCenter
verticalAlignment: Image.AlignVCenter
visible: root.hovered ? root.imageSourceHover !== "" : root.imageSource !== ""
}

Label {
id: buttonLabel

Layout.maximumWidth: icon.width > 0 ? parent.width - icon.width - parent.spacing : parent.width
Layout.fillWidth: icon.status !== Image.Ready
Layout.fillWidth: true

text: root.text
textFormat: Text.PlainText
Expand All @@ -52,7 +54,7 @@ RowLayout {

color: root.hovered ? root.textColorHovered : root.textColor

horizontalAlignment: Text.AlignHCenter
horizontalAlignment: icon.visible ? Text.AlignLeft : Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

elide: Text.ElideRight
Expand Down
1 change: 1 addition & 0 deletions theme/Style/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ QtObject {
property int smallSpacing: 5

property int iconButtonWidth: 36
property int standardPrimaryButtonHeight: 40

property int minActivityHeight: variableSize(40)

Expand Down