moving the presenterView into an item so we can use a gridView

This commit is contained in:
Chris Cochrun 2023-01-27 09:57:05 -06:00
parent 5fb8e867ce
commit 09f5e23612

View file

@ -29,7 +29,7 @@ FocusScope {
ColumnLayout { ColumnLayout {
id: mainGrid id: mainGrid
anchors.fill: parent anchors.fill: parent
anchors.bottomMargin: Kirigami.Units.largeSpacing * 21 /* anchors.bottomMargin: Kirigami.Units.largeSpacing * 2 */
/* columns: 3 */ /* columns: 3 */
/* rowSpacing: 5 */ /* rowSpacing: 5 */
/* columnSpacing: 0 */ /* columnSpacing: 0 */
@ -81,151 +81,148 @@ FocusScope {
} }
Item { Item {
id: presenterView
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
/* Layout.columnSpan: 3 */
Layout.alignment: Qt.AlignTop
Kirigami.Icon { Item {
source: "arrow-left" id: slideArea
implicitWidth: Kirigami.Units.gridUnit * 7 anchors.fill: parent
implicitHeight: Kirigami.Units.gridUnit * 10 anchors.bottomMargin: previewSlidesList.height
anchors.right: previewSlide.left
anchors.verticalCenter: parent.verticalCenter Kirigami.Icon {
/* Layout.alignment: Qt.AlignRight */ source: "arrow-left"
MouseArea { implicitWidth: Kirigami.Units.gridUnit * 7
anchors.fill: parent implicitHeight: Kirigami.Units.gridUnit * 10
onPressed: previousSlideAction() anchors.right: previewSlide.left
cursorShape: Qt.PointingHandCursor anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
onPressed: previousSlideAction()
cursorShape: Qt.PointingHandCursor
}
} }
Presenter.Slide {
id: previewSlide
implicitWidth: root.width - 400 > 200 ? root.width - 400 : 200
implicitHeight: width / 16 * 9
anchors.centerIn: parent
textSize: SlideObject.fontSize
itemType: SlideObject.type
imageSource: SlideObject.imageBackground
videoSource: SlideObject.videoBackground
audioSource: SlideObject.audio
chosenFont: SlideObject.font
text: SlideObject.text
pdfIndex: SlideObject.pdfIndex
preview: true
}
Kirigami.Icon {
source: "arrow-right"
implicitWidth: Kirigami.Units.gridUnit * 7
implicitHeight: Kirigami.Units.gridUnit * 10
anchors.left: previewSlide.right
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
onPressed: nextSlideAction()
cursorShape: Qt.PointingHandCursor
}
}
RowLayout {
spacing: 2
width: previewSlide.width
/* Layout.alignment: Qt.AlignHCenter, Qt.AlignTop */
anchors.top: previewSlide.bottom
anchors.topMargin: 10
anchors.horizontalCenter: previewSlide.horizontalCenter
/* Layout.columnSpan: 3 */
visible: itemType === "video";
Controls.ToolButton {
Layout.preferredWidth: 25
Layout.preferredHeight: 25
icon.name: previewSlide.mpvIsPlaying ? "media-pause" : "media-play"
hoverEnabled: true
onClicked: SlideObject.playPause();
}
Controls.Slider {
id: videoSlider
Layout.fillWidth: true
Layout.preferredHeight: 25
from: 0
to: previewSlide.mpvDuration
value: previewSlide.mpvPosition
live: true
onMoved: changeVidPos(value);
}
Controls.Switch {
text: "Loop"
checked: previewSlide.mpvLoop === "inf" ? true : false
onToggled: mainPage.loopVideo()
Keys.onLeftPressed: previousSlideAction()
Keys.onRightPressed: nextSlideAction()
Keys.onUpPressed: previousSlideAction()
Keys.onDownPressed: nextSlideAction()
}
}
} }
Presenter.Slide { ListView {
id: previewSlide // The active items X value from root
implicitWidth: root.width - 400 property int activeX
implicitHeight: width / 16 * 9 id: previewSlidesList
/* minimumWidth: 200 */ anchors.bottom: presenterView.bottom
anchors.centerIn: parent width: parent.width
textSize: SlideObject.fontSize height: Kirigami.Units.gridUnit * 9
itemType: SlideObject.type orientation: ListView.Horizontal
imageSource: SlideObject.imageBackground spacing: Kirigami.Units.smallSpacing * 2
videoSource: SlideObject.videoBackground cacheBuffer: 900
audioSource: SlideObject.audio reuseItems: true
chosenFont: SlideObject.font model: SlideModel
text: SlideObject.text delegate: Presenter.PreviewSlideListDelegate {}
pdfIndex: SlideObject.pdfIndex
preview: true Kirigami.WheelHandler {
id: wheelHandler
target: previewSlidesList
filterMouseEvents: true
}
Controls.ScrollBar.horizontal: Controls.ScrollBar {
active: hovered || pressed
}
} }
Kirigami.Icon { Rectangle {
source: "arrow-right" id: activeHighlightBar
implicitWidth: Kirigami.Units.gridUnit * 7 width: Kirigami.Units.gridUnit * 10
implicitHeight: Kirigami.Units.gridUnit * 10 height: Kirigami.Units.gridUnit / 4
anchors.left: previewSlide.right y: previewSlidesList.y + Kirigami.Units.gridUnit * 6.15
anchors.verticalCenter: parent.verticalCenter x: previewSlidesList.currentItem.x + Kirigami.Units.smallSpacing
/* Layout.alignment: Qt.AlignLeft */ radius: 5
MouseArea { color: Kirigami.Theme.negativeTextColor
anchors.fill: parent
onPressed: nextSlideAction()
cursorShape: Qt.PointingHandCursor
}
}
RowLayout { Behavior on x { PropertyAnimation {
spacing: 2 properties: "x"
width: previewSlide.width easing.type: Easing.InOutElastic;
/* Layout.alignment: Qt.AlignHCenter, Qt.AlignTop */ easing.period: 1.5
anchors.top: previewSlide.bottom duration: 150
anchors.topMargin: 10 }}
anchors.horizontalCenter: previewSlide.horizontalCenter
/* Layout.columnSpan: 3 */
visible: itemType === "video";
Controls.ToolButton {
Layout.preferredWidth: 25
Layout.preferredHeight: 25
icon.name: previewSlide.mpvIsPlaying ? "media-pause" : "media-play"
hoverEnabled: true
onClicked: SlideObject.playPause();
}
Controls.Slider {
id: videoSlider
Layout.fillWidth: true
Layout.preferredHeight: 25
from: 0
to: previewSlide.mpvDuration
value: previewSlide.mpvPosition
live: true
onMoved: changeVidPos(value);
}
Controls.Switch {
text: "Loop"
checked: previewSlide.mpvLoop === "inf" ? true : false
onToggled: mainPage.loopVideo()
Keys.onLeftPressed: previousSlideAction()
Keys.onRightPressed: nextSlideAction()
Keys.onUpPressed: previousSlideAction()
Keys.onDownPressed: nextSlideAction()
}
} }
} }
/* Item { */
/* Layout.fillHeight: true */
/* Layout.fillWidth: true */
/* Layout.columnSpan: 3 */
/* } */
Item { Item {
Layout.preferredHeight: 60 id: gridView
Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
/* Layout.columnSpan: 3 */
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
visible: false
} }
}
ListView {
// The active items X value from root
property int activeX
id: previewSlidesList
anchors.top: mainGrid.bottom
width: parent.width
height: Kirigami.Units.gridUnit * 9
orientation: ListView.Horizontal
spacing: Kirigami.Units.smallSpacing * 2
cacheBuffer: 900
reuseItems: true
model: SlideModel
delegate: Presenter.PreviewSlideListDelegate {}
Kirigami.WheelHandler {
id: wheelHandler
target: previewSlidesList
filterMouseEvents: true
}
Controls.ScrollBar.horizontal: Controls.ScrollBar {
active: hovered || pressed
}
}
Rectangle {
id: activeHighlightBar
width: Kirigami.Units.gridUnit * 10
height: Kirigami.Units.gridUnit / 4
y: previewSlidesList.y + Kirigami.Units.gridUnit * 6.15
x: previewSlidesList.currentItem.x + Kirigami.Units.smallSpacing
radius: 5
color: Kirigami.Theme.negativeTextColor
Behavior on x { PropertyAnimation {
properties: "x"
easing.type: Easing.InOutElastic;
easing.period: 1.5
duration: 150
}}
} }
Item { Item {