feat: initial commit for pixel-snapping components and helpers
This commit is contained in:
@@ -13,7 +13,7 @@ Item {
|
||||
|
||||
anchors.left: parent?.left
|
||||
anchors.right: parent?.right
|
||||
implicitHeight: Config.launcher.sizes.itemHeight
|
||||
implicitHeight: Tokens.sizes.launcher.itemHeight
|
||||
|
||||
StateLayer {
|
||||
radius: Tokens.rounding.medium
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Config
|
||||
import ZShell.Components
|
||||
import ZShell
|
||||
import qs.Modules.Launcher.Services
|
||||
import qs.Components
|
||||
import qs.Helpers
|
||||
import ZShell.Config
|
||||
import qs.Modules
|
||||
import qs.Services
|
||||
|
||||
@@ -16,53 +19,72 @@ Item {
|
||||
|
||||
anchors.left: parent?.left
|
||||
anchors.right: parent?.right
|
||||
implicitHeight: Config.launcher.sizes.itemHeight
|
||||
implicitHeight: ZUtils.snap(Tokens.sizes.launcher.itemHeight, root)
|
||||
|
||||
StateLayer {
|
||||
radius: Tokens.rounding.medium
|
||||
|
||||
onClicked: {
|
||||
Apps.launch(root.modelData);
|
||||
root.screenState.launcher = false;
|
||||
// Apps.launch(root.modelData);
|
||||
// root.screenState.launcher = false;
|
||||
|
||||
ZUtils.logPlacement(icon, "icon");
|
||||
ZUtils.logPlacement(name, "name");
|
||||
ZUtils.logPlacement(favoriteIcon, "favoriteIcon");
|
||||
ZUtils.logPlacement(comment, "comment");
|
||||
ZUtils.logPlacement(text, "text");
|
||||
ZUtils.logPlacement(mainLayout, "main");
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
SnapLayout {
|
||||
id: mainLayout
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Tokens.padding.medium
|
||||
anchors.margins: Tokens.padding.small
|
||||
anchors.rightMargin: Tokens.padding.medium
|
||||
spacing: Tokens.spacing.medium
|
||||
|
||||
IconImage {
|
||||
id: icon
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
implicitSize: parent.height
|
||||
implicitSize: parent.height - Tokens.padding.small * 2
|
||||
source: Quickshell.iconPath(root.modelData?.icon, "image-missing")
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.left: icon.right
|
||||
anchors.leftMargin: Tokens.spacing.medium
|
||||
anchors.verticalCenter: icon.verticalCenter
|
||||
implicitHeight: name.implicitHeight + comment.implicitHeight
|
||||
implicitWidth: parent.width - icon.width
|
||||
SnapLayout {
|
||||
id: text
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Tokens.padding.extraSmall
|
||||
Layout.bottomMargin: Tokens.padding.extraSmall
|
||||
|
||||
orientation: Qt.Vertical
|
||||
spacing: 0
|
||||
|
||||
CustomText {
|
||||
id: name
|
||||
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: root.modelData?.name ?? ""
|
||||
verticalAlignment: CustomText.AlignVCenter
|
||||
horizontalAlignment: CustomText.AlignLeft
|
||||
}
|
||||
|
||||
CustomText {
|
||||
id: comment
|
||||
|
||||
anchors.top: name.bottom
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
color: Colors.palette.m3outline
|
||||
elide: Text.ElideRight
|
||||
font: Tokens.font.body.small
|
||||
text: (root.modelData?.comment || root.modelData?.genericName || root.modelData?.name) ?? ""
|
||||
width: root.width - icon.width - Tokens.rounding.medium - Tokens.padding.medium * 2
|
||||
verticalAlignment: CustomText.AlignVCenter
|
||||
horizontalAlignment: CustomText.AlignLeft
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,14 +92,16 @@ Item {
|
||||
id: favoriteIcon
|
||||
|
||||
active: root.modelData && Strings.testRegexList(Config.launcher.favoriteApps, root.modelData.id)
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Layout.fillHeight: true
|
||||
|
||||
asynchronous: true
|
||||
|
||||
sourceComponent: MaterialIcon {
|
||||
color: Colors.palette.m3primary
|
||||
fill: 1
|
||||
text: "favorite"
|
||||
|
||||
verticalAlignment: MaterialIcon.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import ZShell
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Components
|
||||
import qs.Components
|
||||
import qs.Modules
|
||||
import qs.Helpers
|
||||
@@ -31,7 +32,7 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
SnapLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.margins: Tokens.padding.small
|
||||
anchors.right: parent.right
|
||||
|
||||
Reference in New Issue
Block a user