2019-07-17 02:37:11 +10:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "../SidePane"
|
|
|
|
|
|
|
|
SwipeView {
|
|
|
|
default property alias columnChildren: contentColumn.children
|
|
|
|
property alias page: innerPage
|
2019-07-17 07:08:06 +10:00
|
|
|
property alias header: innerPage.header
|
|
|
|
property alias footer: innerPage.header
|
2019-07-17 02:37:11 +10:00
|
|
|
property alias flickable: innerFlickable
|
|
|
|
|
2019-07-17 02:53:52 +10:00
|
|
|
property alias headerLabel: innerHeaderLabel
|
|
|
|
property var hideHeaderUnderHeight: null
|
|
|
|
|
2019-07-17 02:37:11 +10:00
|
|
|
property int currentSpacing:
|
2019-07-25 06:41:32 +10:00
|
|
|
Math.min(theme.spacing * width / 400, theme.spacing)
|
2019-07-17 02:37:11 +10:00
|
|
|
|
|
|
|
id: swipeView
|
|
|
|
currentIndex: 1
|
|
|
|
clip: true
|
|
|
|
interactive: sidePane.reduce
|
|
|
|
|
|
|
|
SidePane {
|
2019-07-18 03:34:02 +10:00
|
|
|
implicitWidth: swipeView.width
|
2019-07-17 07:08:06 +10:00
|
|
|
collapse: false
|
|
|
|
reduce: false
|
2019-07-17 02:37:11 +10:00
|
|
|
visible: swipeView.interactive
|
2019-07-17 07:08:06 +10:00
|
|
|
onVisibleChanged: if (currentIndex != 1) swipeView.setCurrentIndex(1)
|
2019-07-17 02:37:11 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: innerPage
|
|
|
|
background: null
|
|
|
|
|
2019-07-17 02:53:52 +10:00
|
|
|
header: HRectangle {
|
2019-07-17 07:08:06 +10:00
|
|
|
implicitWidth: parent ? parent.width : 0
|
2019-07-24 16:14:34 +10:00
|
|
|
color: theme.controls.header.background
|
2019-07-17 02:53:52 +10:00
|
|
|
|
|
|
|
height: ! hideHeaderUnderHeight ||
|
|
|
|
window.height >=
|
|
|
|
hideHeaderUnderHeight +
|
|
|
|
theme.baseElementsHeight +
|
|
|
|
currentSpacing * 2 ?
|
|
|
|
theme.baseElementsHeight : 0
|
|
|
|
|
|
|
|
Behavior on height { HNumberAnimation {} }
|
|
|
|
visible: height > 0
|
|
|
|
|
|
|
|
HRowLayout {
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
HLabel {
|
|
|
|
id: innerHeaderLabel
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
font.pixelSize: theme.fontSize.big
|
|
|
|
elide: Text.ElideRight
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2019-07-19 14:10:46 +10:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
2019-07-17 02:53:52 +10:00
|
|
|
|
|
|
|
Layout.leftMargin: currentSpacing
|
|
|
|
Layout.rightMargin: Layout.leftMargin
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-17 02:37:11 +10:00
|
|
|
leftPadding: currentSpacing < theme.spacing ? 0 : currentSpacing
|
|
|
|
rightPadding: leftPadding
|
|
|
|
Behavior on leftPadding { HNumberAnimation {} }
|
|
|
|
|
2019-07-21 05:06:38 +10:00
|
|
|
HFlickable {
|
2019-07-17 02:37:11 +10:00
|
|
|
id: innerFlickable
|
|
|
|
anchors.fill: parent
|
|
|
|
clip: true
|
|
|
|
contentWidth: parent.width
|
|
|
|
contentHeight: contentColumn.childrenRect.height
|
|
|
|
|
|
|
|
HColumnLayout {
|
|
|
|
id: contentColumn
|
|
|
|
spacing: theme.spacing
|
|
|
|
width: innerFlickable.width
|
|
|
|
height: innerFlickable.height
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|