2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Window
|
|
|
|
|
import QtQuick.Layouts
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
|
|
|
|
import org.kde.kirigami 2.10 as Kirigami
|
|
|
|
|
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
2023-07-25 01:13:52 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
MouseArea {
|
|
|
|
|
id: root
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
property var homeScreen
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
readonly property real verticalMargin: Math.round((Folio.HomeScreenState.pageHeight - Folio.HomeScreenState.pageContentHeight) / 2)
|
|
|
|
|
readonly property real horizontalMargin: Math.round((Folio.HomeScreenState.pageWidth - Folio.HomeScreenState.pageContentWidth) / 2)
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
onPressAndHold: Folio.HomeScreenState.openSettingsView()
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Repeater {
|
|
|
|
|
model: Folio.PageListModel
|
2021-03-26 16:21:30 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
delegate: HomeScreenPage {
|
|
|
|
|
id: homeScreenPage
|
|
|
|
|
pageNum: model.index
|
|
|
|
|
pageModel: model.delegate
|
|
|
|
|
homeScreen: root.homeScreen
|
2021-12-31 00:49:08 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
anchors.fill: root
|
|
|
|
|
anchors.leftMargin: root.horizontalMargin
|
|
|
|
|
anchors.rightMargin: root.horizontalMargin
|
|
|
|
|
anchors.topMargin: root.verticalMargin
|
|
|
|
|
anchors.bottomMargin: root.verticalMargin
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// animation so that full opacity is only when the page is in view
|
|
|
|
|
opacity: 1 - Math.min(1, Math.max(0, Math.abs(-Folio.HomeScreenState.pageViewX - root.width * pageNum) / root.width))
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// x position of page
|
|
|
|
|
transform: Translate {
|
|
|
|
|
x: root.width * index + Folio.HomeScreenState.pageViewX
|
2021-03-18 14:07:33 +00:00
|
|
|
}
|
2021-03-24 13:48:56 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-03-19 16:30:43 +00:00
|
|
|
}
|