Settings: less wide + cleanup about

This commit is contained in:
LemmyCook 2025-08-31 21:35:41 -04:00
parent b0917f5a25
commit 102aca0fa0
4 changed files with 102 additions and 75 deletions

View file

@ -11,8 +11,8 @@ import qs.Widgets
NPanel { NPanel {
id: root id: root
panelWidth: Math.max(screen?.width * 0.5, 1280) * scaling panelWidth: Math.max(screen?.width * 0.4, 768) * scaling
panelHeight: Math.max(screen?.height * 0.5, 720) * scaling panelHeight: Math.max(screen?.height * 0.75, 810) * scaling
panelAnchorHorizontalCenter: true panelAnchorHorizontalCenter: true
panelAnchorVerticalCenter: true panelAnchorVerticalCenter: true
@ -184,7 +184,7 @@ NPanel {
Rectangle { Rectangle {
id: sidebar id: sidebar
Layout.preferredWidth: Style.sliderWidth * 1.3 * scaling Layout.preferredWidth: 220 * scaling
Layout.fillHeight: true Layout.fillHeight: true
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
border.color: Color.mOutline border.color: Color.mOutline
@ -208,6 +208,19 @@ NPanel {
readonly property bool selected: index === currentTabIndex readonly property bool selected: index === currentTabIndex
property bool hovering: false property bool hovering: false
property color tabTextColor: selected ? Color.mOnPrimary : (tabItem.hovering ? Color.mOnTertiary : Color.mOnSurface) property color tabTextColor: selected ? Color.mOnPrimary : (tabItem.hovering ? Color.mOnTertiary : Color.mOnSurface)
Behavior on color {
ColorAnimation {
duration: Style.animationFast
}
}
Behavior on tabTextColor {
ColorAnimation {
duration: Style.animationFast
}
}
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: Style.marginS * scaling anchors.leftMargin: Style.marginS * scaling

View file

@ -46,6 +46,7 @@ ColumnLayout {
Layout.bottomMargin: Style.marginS * scaling Layout.bottomMargin: Style.marginS * scaling
} }
// Versions
GridLayout { GridLayout {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
columns: 2 columns: 2
@ -77,6 +78,7 @@ ColumnLayout {
} }
} }
// Updater
Rectangle { Rectangle {
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.topMargin: Style.marginS * scaling Layout.topMargin: Style.marginS * scaling
@ -137,96 +139,108 @@ ColumnLayout {
NDivider { NDivider {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: Style.marginXL * scaling Layout.topMargin: Style.marginXL * scaling
Layout.bottomMargin: Style.marginxL * scaling Layout.bottomMargin: Style.marginXL * scaling
} }
NText { NText {
text: `Shout-out to our ${root.contributors.length} awesome contributors!` text: `Shout-out to our ${root.contributors.length} <b>awesome</b> contributors!`
font.pointSize: Style.fontSizeL * scaling font.pointSize: Style.fontSizeL * scaling
font.weight: Style.fontWeightBold
color: Color.mOnSurface color: Color.mOnSurface
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.topMargin: Style.marginL * 2
} }
ScrollView { GridView {
Layout.alignment: Qt.AlignCenter id: contributorsGrid
Layout.preferredWidth: 200 * Style.marginXS * scaling
Layout.fillHeight: true
Layout.topMargin: Style.marginL * scaling Layout.topMargin: Style.marginL * scaling
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: cellWidth * 3 // Fixed 3 columns
Layout.preferredHeight: {
if (root.contributors.length === 0)
return 0
const columns = 3
const rows = Math.ceil(root.contributors.length / columns)
return rows * cellHeight
}
cellWidth: Style.baseWidgetSize * 7 * scaling
cellHeight: Style.baseWidgetSize * 3 * scaling
model: root.contributors
clip: true clip: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: ScrollBar.AsNeeded
GridView { delegate: Rectangle {
id: contributorsGrid width: contributorsGrid.cellWidth - Style.marginM * scaling
height: contributorsGrid.cellHeight - Style.marginM * scaling
radius: Style.radiusL * scaling
color: contributorArea.containsMouse ? Color.mTertiary : Color.transparent
anchors.fill: parent Behavior on color {
width: 200 * 4 * scaling ColorAnimation {
height: Math.ceil(root.contributors.length / 4) * 100 duration: Style.animationFast
cellWidth: Style.baseWidgetSize * 7.5 * scaling }
cellHeight: Style.baseWidgetSize * 3.5 * scaling }
model: root.contributors
delegate: Rectangle { RowLayout {
width: contributorsGrid.cellWidth - Style.marginM * scaling anchors.fill: parent
height: contributorsGrid.cellHeight - Style.marginS * scaling anchors.margins: Style.marginS * scaling
radius: Style.radiusL * scaling spacing: Style.marginM * scaling
color: contributorArea.containsMouse ? Color.mSecondary : Color.transparent
RowLayout { Item {
anchors.fill: parent Layout.alignment: Qt.AlignVCenter
anchors.margins: Style.marginS * scaling Layout.preferredWidth: Style.baseWidgetSize * 2 * scaling
spacing: Style.marginM * scaling Layout.preferredHeight: Style.baseWidgetSize * 2 * scaling
Item { NImageCircled {
Layout.alignment: Qt.AlignVCenter imagePath: modelData.avatar_url || ""
Layout.preferredWidth: Style.baseWidgetSize * 2 * scaling anchors.fill: parent
Layout.preferredHeight: Style.baseWidgetSize * 2 * scaling anchors.margins: Style.marginXS * scaling
fallbackIcon: "person"
borderColor: contributorArea.containsMouse ? Color.mOnTertiary : Color.mPrimary
borderWidth: Math.max(1, Style.borderM * scaling)
NImageCircled { Behavior on borderColor {
imagePath: modelData.avatar_url || "" ColorAnimation {
anchors.fill: parent duration: Style.animationFast
anchors.margins: Style.marginXS * scaling }
fallbackIcon: "person"
borderColor: Color.mPrimary
borderWidth: Math.max(1, Style.borderM * scaling)
}
}
ColumnLayout {
spacing: Style.marginXS * scaling
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
NText {
text: modelData.login || "Unknown"
font.weight: Style.fontWeightBold
color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface
elide: Text.ElideRight
Layout.fillWidth: true
}
NText {
text: (modelData.contributions || 0) + " " + ((modelData.contributions || 0) === 1 ? "commit" : "commits")
font.pointSize: Style.fontSizeXS * scaling
color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface
} }
} }
} }
MouseArea { ColumnLayout {
id: contributorArea spacing: Style.marginXS * scaling
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
anchors.fill: parent NText {
hoverEnabled: true text: modelData.login || "Unknown"
cursorShape: Qt.PointingHandCursor font.weight: Style.fontWeightBold
onClicked: { color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface
if (modelData.html_url) elide: Text.ElideRight
Quickshell.execDetached(["xdg-open", modelData.html_url]) Layout.fillWidth: true
} }
NText {
text: (modelData.contributions || 0) + " " + ((modelData.contributions || 0) === 1 ? "commit" : "commits")
font.pointSize: Style.fontSizeXS * scaling
color: contributorArea.containsMouse ? Color.mSurface : Color.mOnSurface
}
}
}
MouseArea {
id: contributorArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if (modelData.html_url)
Quickshell.execDetached(["xdg-open", modelData.html_url])
} }
} }
} }
} }
Item {
Layout.fillHeight: true
}
} }

View file

@ -180,9 +180,9 @@ ColumnLayout {
// Color Schemes Grid // Color Schemes Grid
GridLayout { GridLayout {
columns: 4 columns: 3
rowSpacing: Style.marginL * scaling rowSpacing: Style.marginM * scaling
columnSpacing: Style.marginL * scaling columnSpacing: Style.marginM * scaling
Layout.fillWidth: true Layout.fillWidth: true
Repeater { Repeater {

View file

@ -100,7 +100,7 @@ ColumnLayout {
interactive: false interactive: false
clip: true clip: true
property int columns: 5 property int columns: 4
property int itemSize: Math.floor((width - leftMargin - rightMargin - (4 * Style.marginS * scaling)) / columns) property int itemSize: Math.floor((width - leftMargin - rightMargin - (4 * Style.marginS * scaling)) / columns)
cellWidth: Math.floor((width - leftMargin - rightMargin) / columns) cellWidth: Math.floor((width - leftMargin - rightMargin) / columns)
@ -118,7 +118,7 @@ ColumnLayout {
property bool isSelected: screen ? (wallpaperPath === WallpaperService.getWallpaper(screen.name)) : false property bool isSelected: screen ? (wallpaperPath === WallpaperService.getWallpaper(screen.name)) : false
width: wallpaperGridView.itemSize width: wallpaperGridView.itemSize
height: Math.floor(wallpaperGridView.itemSize * 0.67) height: Math.round(wallpaperGridView.itemSize * 0.67)
color: Color.transparent color: Color.transparent
// NImageCached relies on the image being visible to work properly. // NImageCached relies on the image being visible to work properly.
@ -179,7 +179,7 @@ ColumnLayout {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
hoverEnabled: true hoverEnabled: true
onClicked: { onPressed: {
if (Settings.data.wallpaper.setWallpaperOnAllMonitors) { if (Settings.data.wallpaper.setWallpaperOnAllMonitors) {
WallpaperService.changeWallpaper(undefined, wallpaperPath) WallpaperService.changeWallpaper(undefined, wallpaperPath)
} else if (screen) { } else if (screen) {