cleaning the ui to make the previewSlidesList always stay on bottom

This commit is contained in:
Chris Cochrun 2022-10-22 13:58:52 -05:00
parent 72fa64369f
commit 2fcd936bd5

View file

@ -11,6 +11,8 @@ import org.presenter 1.0
FocusScope { FocusScope {
id: root id: root
height: parent.height
property var text property var text
property int textIndex: 0 property int textIndex: 0
property string itemType: SlideObject.type property string itemType: SlideObject.type
@ -21,29 +23,20 @@ FocusScope {
property bool focusTimer: true property bool focusTimer: true
Item {
id: keyHandler
anchors.fill: parent
focus: true
Keys.onLeftPressed: previousSlideAction()
Keys.onRightPressed: nextSlideAction()
Keys.onUpPressed: previousSlideAction()
Keys.onDownPressed: nextSlideAction()
Keys.onSpacePressed: nextSlideAction()
}
/* Component.onCompleted: nextSlideAction() */ /* Component.onCompleted: nextSlideAction() */
GridLayout { ColumnLayout {
id: mainGrid
anchors.fill: parent anchors.fill: parent
anchors.bottomMargin: 50 anchors.bottomMargin: 160
columns: 3 /* columns: 3 */
rowSpacing: 5 /* rowSpacing: 5 */
columnSpacing: 0 /* columnSpacing: 0 */
Controls.ToolBar { Controls.ToolBar {
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 3 /* Layout.columnSpan: 3 */
Layout.alignment: Qt.AlignTop
id: toolbar id: toolbar
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
@ -76,22 +69,17 @@ FocusScope {
} }
Item { Item {
/* Layout.preferredHeight: 200 */
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 3 /* Layout.columnSpan: 3 */
} Layout.alignment: Qt.AlignTop
Item {
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 3
Kirigami.Icon { Kirigami.Icon {
source: "arrow-left" source: "arrow-left"
implicitWidth: 100 implicitWidth: 100
implicitHeight: 200 implicitHeight: 200
anchors.right: previewSlide.left anchors.right: previewSlide.left
anchors.verticalCenter: parent.verticalCenter
/* Layout.alignment: Qt.AlignRight */ /* Layout.alignment: Qt.AlignRight */
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -122,6 +110,7 @@ FocusScope {
implicitWidth: 100 implicitWidth: 100
implicitHeight: 200 implicitHeight: 200
anchors.left: previewSlide.right anchors.left: previewSlide.right
anchors.verticalCenter: parent.verticalCenter
/* Layout.alignment: Qt.AlignLeft */ /* Layout.alignment: Qt.AlignLeft */
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -130,72 +119,74 @@ FocusScope {
} }
} }
} 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";
Kirigami.Icon {
source: previewSlide.mpvIsPlaying ? "media-pause" : "media-play"
Layout.preferredWidth: 25
Layout.preferredHeight: 25
MouseArea {
anchors.fill: parent
onPressed: SlideObject.playPause();
cursorShape: Qt.PointingHandCursor
}
}
Controls.Slider {
id: videoSlider
Layout.fillWidth: true
Layout.preferredHeight: 25
from: 0
to: previewSlide.mpvDuration
value: previewSlide.mpvPosition
live: true
onMoved: changeVidPos(value);
}
Item { Controls.Switch {
Layout.fillWidth: true text: "Loop"
} checked: previewSlide.mpvLoop === "inf" ? true : false
onToggled: mainPage.loopVideo()
RowLayout { Keys.onLeftPressed: previousSlideAction()
spacing: 2 Keys.onRightPressed: nextSlideAction()
Layout.preferredWidth: previewSlide.width - 50 Keys.onUpPressed: previousSlideAction()
/* Layout.columnSpan: 3 */ Keys.onDownPressed: nextSlideAction()
visible: itemType === "video";
Kirigami.Icon {
source: previewSlide.mpvIsPlaying ? "media-pause" : "media-play"
Layout.preferredWidth: 25
Layout.preferredHeight: 25
MouseArea {
anchors.fill: parent
onPressed: SlideObject.playPause();
cursorShape: Qt.PointingHandCursor
} }
} }
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.fillWidth: true
}
Item {
/* Layout.preferredHeight: 200 */
Layout.fillHeight: true
Layout.fillWidth: true
Layout.columnSpan: 3
} }
/* Item { */ /* Item { */
/* /\* Layout.preferredHeight: 20 *\/ */
/* Layout.fillHeight: true */ /* Layout.fillHeight: true */
/* Layout.fillWidth: true */ /* Layout.fillWidth: true */
/* Layout.columnSpan: 3 */ /* Layout.columnSpan: 3 */
/* } */ /* } */
Item {
Layout.preferredHeight: 60
Layout.fillWidth: true
/* Layout.columnSpan: 3 */
Layout.alignment: Qt.AlignTop
}
} }
ListView { ListView {
id: previewSlidesList id: previewSlidesList
anchors.bottom: parent.bottom /* Layout.fillHeight: true */
/* Layout.fillWidth: true */
/* Layout.columnSpan: 3 */
/* Layout.alignment: Qt.AlignBottom */
/* Layout.bottomMargin: 140 */
anchors.top: mainGrid.bottom
anchors.bottom: root.bottom
/* anchors.bottomMargin: 100 */
width: parent.width
orientation: ListView.Horizontal orientation: ListView.Horizontal
cacheBuffer: 900 cacheBuffer: 900
reuseItems: true reuseItems: true
@ -263,6 +254,18 @@ FocusScope {
} }
} }
Item {
id: keyHandler
/* anchors.fill: parent */
focus: true
Keys.onLeftPressed: previousSlideAction()
Keys.onRightPressed: nextSlideAction()
Keys.onUpPressed: previousSlideAction()
Keys.onDownPressed: nextSlideAction()
Keys.onSpacePressed: nextSlideAction()
}
Connections { Connections {
target: SlideObject target: SlideObject
function onVideoBackgroundChanged() { function onVideoBackgroundChanged() {