parent
56ea40a9a0
commit
66c0d0a15f
5 changed files with 36 additions and 11 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import qs.services
|
||||
import qs.config
|
||||
import qs.modules.osd as Osd
|
||||
import qs.modules.notifications as Notifications
|
||||
|
|
@ -64,6 +63,7 @@ Item {
|
|||
id: launcher
|
||||
|
||||
visibilities: root.visibilities
|
||||
panels: root
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@ import QtQuick
|
|||
Item {
|
||||
id: root
|
||||
|
||||
required property var wrapper
|
||||
required property PersistentProperties visibilities
|
||||
required property var panels
|
||||
|
||||
readonly property int padding: Appearance.padding.large
|
||||
readonly property int rounding: Appearance.rounding.large
|
||||
|
||||
|
|
@ -34,7 +37,9 @@ Item {
|
|||
ContentList {
|
||||
id: list
|
||||
|
||||
wrapper: root.wrapper
|
||||
visibilities: root.visibilities
|
||||
panels: root.panels
|
||||
search: search
|
||||
padding: root.padding
|
||||
rounding: root.rounding
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ import QtQuick.Controls
|
|||
Item {
|
||||
id: root
|
||||
|
||||
required property var wrapper
|
||||
required property PersistentProperties visibilities
|
||||
required property var panels
|
||||
required property TextField search
|
||||
required property int padding
|
||||
required property int rounding
|
||||
|
|
@ -103,6 +105,8 @@ Item {
|
|||
sourceComponent: WallpaperList {
|
||||
search: root.search
|
||||
visibilities: root.visibilities
|
||||
panels: root.panels
|
||||
wrapper: root.wrapper
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,18 +12,31 @@ PathView {
|
|||
|
||||
required property TextField search
|
||||
required property PersistentProperties visibilities
|
||||
readonly property int numItems: {
|
||||
const screenWidth = QsWindow.window?.screen.width * 0.8;
|
||||
if (!screenWidth)
|
||||
return 0;
|
||||
const itemWidth = Config.launcher.sizes.wallpaperWidth * 0.8;
|
||||
const max = Config.launcher.maxWallpapers;
|
||||
const maxItemsOnScreen = Math.floor(screenWidth / itemWidth);
|
||||
required property var panels
|
||||
required property var wrapper
|
||||
|
||||
readonly property int itemWidth: Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2
|
||||
|
||||
readonly property int numItems: {
|
||||
const screen = QsWindow.window?.screen;
|
||||
if (!screen)
|
||||
return 0;
|
||||
|
||||
// Screen width - 4x outer rounding - 2x max side thickness (cause centered)
|
||||
let outerMargins = Math.max(Config.border.thickness, panels.bar.implicitWidth);
|
||||
if (panels.popouts.hasCurrent && panels.popouts.currentCenter + panels.popouts.nonAnimHeight / 2 > screen.height - wrapper.implicitHeight - Config.border.thickness * 2)
|
||||
outerMargins = panels.bar.implicitWidth + panels.popouts.nonAnimWidth;
|
||||
const maxWidth = screen.width - Config.border.rounding * 4 - outerMargins * 2;
|
||||
|
||||
if (maxWidth <= 0)
|
||||
return 0;
|
||||
|
||||
const maxItemsOnScreen = Math.floor(maxWidth / itemWidth);
|
||||
const visible = Math.min(maxItemsOnScreen, Config.launcher.maxWallpapers, scriptModel.values.length);
|
||||
|
||||
const visible = Math.min(maxItemsOnScreen, max, scriptModel.values.length);
|
||||
if (visible === 2)
|
||||
return 1;
|
||||
else if (visible > 1 && visible % 2 === 0)
|
||||
if (visible > 1 && visible % 2 === 0)
|
||||
return visible - 1;
|
||||
return visible;
|
||||
}
|
||||
|
|
@ -45,7 +58,7 @@ PathView {
|
|||
Wallpapers.preview(currentItem.modelData.path);
|
||||
}
|
||||
|
||||
implicitWidth: Math.min(numItems, count) * (Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
|
||||
implicitWidth: Math.min(numItems, count) * itemWidth
|
||||
pathItemCount: numItems
|
||||
cacheItemCount: 4
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ Item {
|
|||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
required property var panels
|
||||
|
||||
visible: height > 0
|
||||
implicitHeight: 0
|
||||
|
|
@ -50,6 +51,8 @@ Item {
|
|||
Content {
|
||||
id: content
|
||||
|
||||
wrapper: root
|
||||
visibilities: root.visibilities
|
||||
panels: root.panels
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue