Getting some functionality in switching slides

This commit is contained in:
Chris Cochrun 2022-03-11 07:04:23 -06:00
parent 1fa5aa8a0a
commit cc8f447166
7 changed files with 72 additions and 4 deletions

View file

@ -1,4 +1,5 @@
;;; Directory Local Variables ;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables") ;;; For more information see (info "(emacs) Directory Variables")
((nil . ((compile-command . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B build/ . && make --dir build/")))) ((nil . ((projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B build/ . && make --dir build/")
(projectile-project-run-cmd . "./build/bin/presenter"))))

View file

@ -1,6 +1,7 @@
import QtQuick 2.13 import QtQuick 2.13
import QtQuick.Dialogs 1.0 import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls import QtQuick.Controls 2.15 as Controls
import Qt.labs.platform 1.1 as Labs
import QtQuick.Window 2.13 import QtQuick.Window 2.13
import QtQuick.Layouts 1.2 import QtQuick.Layouts 1.2
import QtMultimedia 5.15 import QtMultimedia 5.15
@ -21,6 +22,29 @@ Kirigami.ApplicationWindow {
pageStack.initialPage: mainPage pageStack.initialPage: mainPage
header: Presenter.Header {} header: Presenter.Header {}
/* Loader { */
/* Labs.MenuBar { */
/* Labs.Menu { */
/* title: qsTr("File") */
/* Labs.MenuItem { text: qsTr("New...") } */
/* Labs.MenuItem { text: qsTr("Open...") } */
/* Labs.MenuItem { text: qsTr("Save") } */
/* Labs.MenuItem { text: qsTr("Save As...") } */
/* Labs.MenuSeparator { } */
/* Labs.MenuItem { text: qsTr("Quit") } */
/* } */
/* Labs.Menu { */
/* title: qsTr("Edit") */
/* Labs.MenuItem { text: qsTr("Cut") } */
/* Labs.MenuItem { text: qsTr("Copy") } */
/* Labs.MenuItem { text: qsTr("Paste") } */
/* } */
/* Labs.Menu { */
/* title: qsTr("Help") */
/* Labs.MenuItem { text: qsTr("About") } */
/* } */
/* } */
/* } */
width: 1800 width: 1800
height: 900 height: 900

View file

@ -37,7 +37,7 @@ Kirigami.ActionToolBar {
Kirigami.Action { Kirigami.Action {
icon.name: "view-presentation" icon.name: "view-presentation"
text: "Go Live" text: presenting ? "Presenting" : "Go Live"
onTriggered: { onTriggered: {
print("Window is loading") print("Window is loading")
presenting = true presenting = true

View file

@ -120,6 +120,7 @@ Item {
displayComponent: Component { displayComponent: Component {
Kirigami.SearchField { Kirigami.SearchField {
id: searchField id: searchField
height: parent.height
width: parent.width - 40 width: parent.width - 40
onAccepted: showPassiveNotification(searchField.text, 3000) onAccepted: showPassiveNotification(searchField.text, 3000)
} }

View file

@ -155,7 +155,8 @@ Controls.Page {
/* showPassiveNotification("used to be: " + presentation.text); */ /* showPassiveNotification("used to be: " + presentation.text); */
presentation.text = text; presentation.text = text;
/* showPassiveNotification("next"); */ /* showPassiveNotification("next"); */
presentationSlide.text = text; if (slideItem)
slideItem.text = text;
/* showPassiveNotification("last"); */ /* showPassiveNotification("last"); */
} }
@ -166,12 +167,30 @@ Controls.Page {
if (type == "image") { if (type == "image") {
presentation.vidbackground = ""; presentation.vidbackground = "";
presentation.imagebackground = background; presentation.imagebackground = background;
if (slideItem) {
slideItem.videoSource = "";
slideItem.stopVideo();
slideItem.imageSource = background;
}
} else { } else {
presentation.imagebackground = ""; presentation.imagebackground = "";
presentation.vidbackground = background; presentation.vidbackground = background;
presentation.loadVideo() presentation.loadVideo()
if (slideItem) {
slideItem.imageSource = "";
slideItem.videoSource = background;
slideItem.loadVideo()
} }
} }
}
function changeSlideNext() {
showPassiveNotification("next slide please")
}
function changeSlidePrevious() {
showPassiveNotification("previous slide please")
}
function editSwitch(edit) { function editSwitch(edit) {
if (edit) if (edit)

View file

@ -66,6 +66,11 @@ Item {
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.preferredHeight: 200 Layout.preferredHeight: 200
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
MouseArea {
anchors.fill: parent
onPressed: changeSlidePrevious()
cursorShape: Qt.PointingHandCursor
}
} }
Presenter.Slide { Presenter.Slide {
@ -77,6 +82,7 @@ Item {
text: root.text text: root.text
imageSource: imagebackground imageSource: imagebackground
videoSource: vidbackground videoSource: vidbackground
preview: true
} }
Kirigami.Icon { Kirigami.Icon {
@ -84,6 +90,11 @@ Item {
Layout.preferredWidth: 100 Layout.preferredWidth: 100
Layout.preferredHeight: 200 Layout.preferredHeight: 200
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
MouseArea {
anchors.fill: parent
onPressed: changeSlideNext()
cursorShape: Qt.PointingHandCursor
}
} }
Item { Item {

View file

@ -23,8 +23,14 @@ Item {
property string text: "This is demo text" property string text: "This is demo text"
property color backgroundColor property color backgroundColor
//these properties are for giving video info to parents
property int mpvPosition: mpv.position
property int mpvDuration: mpv.duration
property var mpvLoop: mpv.getProperty("loop")
// These properties help to determine the state of the slide // These properties help to determine the state of the slide
property string itemType property string itemType
property bool preview: false
Rectangle { Rectangle {
id: basePrColor id: basePrColor
@ -36,6 +42,7 @@ Item {
objectName: "mpv" objectName: "mpv"
anchors.fill: parent anchors.fill: parent
useHwdec: true useHwdec: true
enableAudio: !preview
Component.onCompleted: mpvLoadingTimer.start() Component.onCompleted: mpvLoadingTimer.start()
onFileLoaded: { onFileLoaded: {
print(videoSource + " has been loaded"); print(videoSource + " has been loaded");
@ -49,6 +56,7 @@ Item {
anchors.fill: parent anchors.fill: parent
enabled: editMode enabled: editMode
onPressed: mpv.loadFile(videoSource.toString()); onPressed: mpv.loadFile(videoSource.toString());
cursorShape: preview ? Qt.ArrowCursor : Qt.BlankCursor
} }
Controls.ProgressBar { Controls.ProgressBar {
@ -113,4 +121,8 @@ Item {
function loadVideo() { function loadVideo() {
mpvLoadingTimer.restart() mpvLoadingTimer.restart()
} }
function stopVideo() {
mpv.stop()
}
} }