Skip to content

Commit

Permalink
Work on components
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Jul 26, 2024
1 parent a0707e2 commit 477c628
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 37 deletions.
2 changes: 2 additions & 0 deletions qml/ComponentLibrary/generic/AndroidButtonIcon.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ T.Button {
// settings
property url source
property int sourceSize: 26
property int sourceRotation: 0
property int layoutDirection: Qt.LeftToRight

// colors
Expand Down Expand Up @@ -93,6 +94,7 @@ T.Button {

width: control.sourceSize
height: control.sourceSize
rotation: control.sourceRotation

source: control.source
color: control.colorPrimary
Expand Down
10 changes: 7 additions & 3 deletions qml/ComponentLibrary/generic/ButtonChip.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ T.Button {
// colors
property color color: Theme.colorPrimary

// icon
// icons
property string leftIcon
property int leftIconSize: UtilsNumber.alignTo(height * 1.0, 2)
property int leftIconRotation: 0
property string rightIcon
property int rightIconSize: UtilsNumber.alignTo(height * 0.5, 2)
property int rightIconRotation: 0

////////////////

Expand Down Expand Up @@ -99,9 +101,10 @@ T.Button {
visible: control.leftIcon.length

IconSvg {
anchors.centerIn: parent
width: control.leftIconSize
height: control.leftIconSize
anchors.centerIn: parent
rotation: control.leftIconRotation

color: control.color
source: control.leftIcon
Expand Down Expand Up @@ -129,9 +132,10 @@ T.Button {
visible: control.rightIcon.length

IconSvg {
anchors.centerIn: parent
width: control.rightIconSize
height: control.rightIconSize
anchors.centerIn: parent
rotation: control.rightIconRotation

color: control.color
source: control.rightIcon
Expand Down
5 changes: 2 additions & 3 deletions qml/ComponentLibrary/maps/MapButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ T.Button {
}
/*
RippleThemed {
width: parent.width
height: parent.height
anchors.fill: parent
anchor: control
clip: visible
anchor: control
pressed: control.pressed
active: enabled && (control.down || control.visualFocus || control.hovered)
color: Qt.rgba(Theme.colorForeground.r, Theme.colorForeground.g, Theme.colorForeground.b, 0.9)
Expand Down
5 changes: 2 additions & 3 deletions qml/ComponentLibrary/maps/MapButtonCompass.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ T.Button {
}
/*
RippleThemed {
width: parent.width
height: parent.height
anchors.fill: parent
anchor: control
clip: visible
anchor: control
pressed: control.pressed
active: enabled && (control.down || control.visualFocus || control.hovered)
color: Qt.rgba(Theme.colorForeground.r, Theme.colorForeground.g, Theme.colorForeground.b, 0.9)
Expand Down
2 changes: 2 additions & 0 deletions qml/ComponentLibrary/menus/ActionMenuItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ T.Button {
property int index
property url source
property int sourceSize: 20
property int sourceRotation: 0
property int layoutDirection: Qt.RightToLeft

////////////////
Expand Down Expand Up @@ -81,6 +82,7 @@ T.Button {
Layout.preferredHeight: control.sourceSize

source: control.source
rotation: control.sourceRotation
color: Theme.colorIcon
}

Expand Down
7 changes: 5 additions & 2 deletions qml/ComponentLibrary/menus/ActionMenu_bottom.qml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ T.Popup {

background: Rectangle {
color: Theme.colorComponentBackground

Rectangle {
width: parent.width
anchors.left: parent.left
anchors.right: parent.right
height: Theme.componentBorderWidth
color: Theme.colorSeparator
}
Expand All @@ -59,7 +61,8 @@ T.Popup {
contentItem: Item {
Column {
id: contentColumn
width: parent.width
anchors.left: parent.left
anchors.right: parent.right

topPadding: 12
bottomPadding: 8
Expand Down
3 changes: 2 additions & 1 deletion qml/ComponentLibrary/menus/ActionMenu_floating.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ T.Popup {
contentItem: Item {
Column {
id: contentColumn
width: parent.width
anchors.left: parent.left
anchors.right: parent.right

topPadding: 10
bottomPadding: 10
Expand Down
34 changes: 14 additions & 20 deletions qml/ComponentLibrary/menus/DesktopSidebarItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ T.Button {
implicitHeight: 64

width: parent.width // width drive the size of this element
height: Math.max(parent.width, content.height + 24)
height: Math.max(parent.width, contentColumn.height + 24)

focusPolicy: Qt.NoFocus

// settings
property url source
property int sourceSize: 40
property int sourceRotation: 0
property string highlightMode: "background" // available: background, indicator, circle, content

// colors
Expand All @@ -30,16 +31,16 @@ T.Button {
property bool indicatorVisible: false
property bool indicatorAnimated: false
property color indicatorColor: "white"
property url indicatorSource: ""
property url indicatorSource

////////////////////////////////////////////////////////////////////////////

background: Rectangle {
implicitWidth: 64
implicitHeight: 64

width: (control.highlightMode === "circle") ? height : parent.width
height: parent.height
width: control.width
height: control.height
radius: (control.highlightMode === "circle") ? width : 0

visible: (control.highlightMode === "background" ||
Expand Down Expand Up @@ -67,31 +68,25 @@ T.Button {
////////////////////////////////////////////////////////////////////////////

ColumnLayout {
id: content
id: contentColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: -4

IconSvg {
id: contentImage
width: control.sourceSize
height: control.sourceSize

IconSvg { // contentImage
Layout.preferredWidth: control.sourceSize
Layout.preferredHeight: control.sourceSize
Layout.alignment: Qt.AlignHCenter
Layout.minimumWidth: control.sourceSize
Layout.minimumHeight: control.sourceSize
Layout.maximumWidth: control.sourceSize
Layout.maximumHeight: control.sourceSize

visible: source.toString().length

source: control.source
rotation: control.sourceRotation
color: (!control.highlighted && control.highlightMode === "content") ? control.colorHighlight : control.colorContent
opacity: control.enabled ? 1 : 0.66

Item {
id: contentIndicator
Item { // activityIndicator
width: 24; height: 24;
anchors.right: parent.right
anchors.rightMargin: -4
Expand Down Expand Up @@ -124,9 +119,9 @@ T.Button {
}
}

Text {
id: contentText
width: parent.width
Text { // contentText
Layout.preferredWidth: control.sourceSize
Layout.alignment: Qt.AlignHCenter

visible: control.text
text: control.text
Expand All @@ -135,7 +130,6 @@ T.Button {
font.pixelSize: Theme.fontSizeContentVerySmall
font.bold: true

Layout.alignment: Qt.AlignHCenter
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Expand Down
4 changes: 2 additions & 2 deletions qml/ComponentLibrary/menus/DrawerButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ T.ItemDelegate {
anchors.rightMargin: 8

RippleThemed {
width: parent.width
height: parent.height
anchors.fill: parent
anchor: control

pressed: control.pressed
active: enabled && (control.down || control.visualFocus || control.hovered)
Expand Down
5 changes: 2 additions & 3 deletions qml/ComponentLibrary/menus/DrawerItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ T.ItemDelegate {
color: control.highlighted ? Theme.colorForeground : Theme.colorBackground

RippleThemed {
width: parent.width
height: parent.height
anchors.fill: parent
anchor: control

clip: visible
anchor: control
pressed: control.pressed
active: enabled && (control.down || control.visualFocus || control.hovered)
color: Qt.rgba(Theme.colorForeground.r, Theme.colorForeground.g, Theme.colorForeground.b, 0.5)
Expand Down

0 comments on commit 477c628

Please sign in to comment.