271 lines
8 KiB
QML
271 lines
8 KiB
QML
import QtQuick 2.15
|
|
import QtQuick.Dialogs 1.0
|
|
import QtQuick.Controls 2.15 as Controls
|
|
import QtQuick.Window 2.13
|
|
import QtQuick.Layouts 1.2
|
|
import org.kde.kirigami 2.13 as Kirigami
|
|
import "./" as Presenter
|
|
import org.presenter 1.0
|
|
|
|
Controls.Page {
|
|
id: mainPage
|
|
padding: 0
|
|
|
|
// properties passed around for the slides
|
|
property int currentServiceItem
|
|
property url imageBackground: presentation.imageBackground
|
|
property url videoBackground: presentation.vidBackground
|
|
property string currentText: presentation.text
|
|
property int blurRadius: 0
|
|
property int totalServiceItems
|
|
|
|
/* property var video */
|
|
property int dragItemIndex
|
|
property string dragItemTitle: ""
|
|
property string dragItemType: ""
|
|
property string dragItemText: ""
|
|
property string dragItemAudio: ""
|
|
property string dragItemBackgroundType: ""
|
|
property string dragItemBackground: ""
|
|
property string dragItemFont: ""
|
|
property string dragItemFontSize
|
|
|
|
property bool editing: true
|
|
|
|
property Item slideItem
|
|
property var song
|
|
property var draggedLibraryItem
|
|
|
|
property var serviceItems: serviceItemModel
|
|
|
|
property bool songDragged: false
|
|
|
|
property string editType
|
|
|
|
property var currentWindow: presentation
|
|
|
|
property var dragHighlightLine
|
|
|
|
Component.onCompleted: {
|
|
changeServiceItem(0);
|
|
presentation.forceActiveFocus();
|
|
/* const loaded = serviceItemModel.loadLastSaved(); */
|
|
/* if (!loaded) */
|
|
/* showPassiveNotification("Failed loading last file"); */
|
|
}
|
|
|
|
Item {
|
|
id: mainItem
|
|
anchors.fill: parent
|
|
|
|
Controls.SplitView {
|
|
id: splitMainView
|
|
anchors.fill: parent
|
|
handle: Item{
|
|
implicitWidth: 6
|
|
Rectangle {
|
|
height: parent.height
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
width: 1
|
|
color: Controls.SplitHandle.hovered ? Kirigami.Theme.hoverColor : Kirigami.Theme.backgroundColor
|
|
}
|
|
}
|
|
|
|
Presenter.ServiceList {
|
|
id: leftDock
|
|
Controls.SplitView.preferredWidth: Kirigami.Units.largeSpacing * 40
|
|
Controls.SplitView.maximumWidth: Kirigami.Units.largeSpacing * 60
|
|
z: 1
|
|
}
|
|
|
|
FocusScope {
|
|
id: mainPageArea
|
|
Controls.SplitView.fillWidth: true
|
|
Controls.SplitView.fillHeight: true
|
|
Controls.SplitView.minimumWidth: 100
|
|
|
|
Presenter.Presentation {
|
|
id: presentation
|
|
anchors.fill: parent
|
|
focus: true
|
|
}
|
|
|
|
Presenter.SongEditor {
|
|
id: songEditor
|
|
visible: false
|
|
anchors.fill: parent
|
|
}
|
|
|
|
Presenter.VideoEditor {
|
|
id: videoEditor
|
|
visible: false
|
|
anchors.fill: parent
|
|
}
|
|
|
|
Presenter.ImageEditor {
|
|
id: imageEditor
|
|
visible: false
|
|
anchors.fill: parent
|
|
}
|
|
|
|
Presenter.PresentationEditor {
|
|
id: presentationEditor
|
|
visible: false
|
|
anchors.fill: parent
|
|
}
|
|
}
|
|
|
|
Presenter.Library {
|
|
id: library
|
|
Controls.SplitView.preferredWidth: libraryOpen ? Kirigami.Units.largeSpacing * 40 : 0
|
|
Controls.SplitView.maximumWidth: Kirigami.Units.largeSpacing * 60
|
|
visible: libraryOpen ? true : false
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
Presenter.PresentationWindow {
|
|
id: pWindow
|
|
}
|
|
|
|
SongSqlModel {
|
|
id: songsqlmodel
|
|
}
|
|
|
|
VideoSqlModel {
|
|
id: videosqlmodel
|
|
}
|
|
|
|
ImageSqlModel {
|
|
id: imagesqlmodel
|
|
}
|
|
|
|
PresentationSqlModel {
|
|
id: pressqlmodel
|
|
}
|
|
|
|
ServiceItemModel {
|
|
id: serviceItemModel
|
|
}
|
|
|
|
ServiceThing {
|
|
id: serviceThing
|
|
}
|
|
|
|
function changeServiceItem(index) {
|
|
const item = serviceItemModel.getItem(index);
|
|
currentServiceItem = index;
|
|
print("index grabbed: " + index);
|
|
print(item);
|
|
|
|
presentation.stopVideo();
|
|
pWindow.stopVideo();
|
|
/* presentation.itemType = item.type; */
|
|
print("Time to start changing");
|
|
|
|
serviceItemModel.activate(index);
|
|
SlideObject.changeSlide(item);
|
|
|
|
/* if (item.backgroundType === "video") */
|
|
/* { */
|
|
/* presentation.loadVideo(); */
|
|
/* } */
|
|
|
|
presentation.textIndex = 0;
|
|
/* serviceItemModel.select(index); */
|
|
/* presentation.changeSlide(); */
|
|
|
|
print("Slide changed to: " + item.name);
|
|
}
|
|
|
|
function loopVideo() {
|
|
presentation.loopVideo();
|
|
pWindow.loopVideo();
|
|
}
|
|
|
|
function editSwitch(item) {
|
|
if (editMode) {
|
|
switch (editType) {
|
|
case "song" :
|
|
presentation.visible = false;
|
|
videoEditor.visible = false;
|
|
videoEditor.stop();
|
|
imageEditor.visible = false;
|
|
presentationEditor.visible = false;
|
|
songEditor.visible = true;
|
|
songEditor.changeSong(item);
|
|
currentWindow = songEditor;
|
|
break;
|
|
case "video" :
|
|
presentation.visible = false;
|
|
songEditor.visible = false;
|
|
imageEditor.visible = false;
|
|
presentationEditor.visible = false;
|
|
videoEditor.visible = true;
|
|
videoEditor.changeVideo(item);
|
|
currentWindow = videoEditor;
|
|
break;
|
|
case "image" :
|
|
presentation.visible = false;
|
|
videoEditor.visible = false;
|
|
videoEditor.stop();
|
|
songEditor.visible = false;
|
|
presentationEditor.visible = false;
|
|
imageEditor.visible = true;
|
|
imageEditor.changeImage(item);
|
|
currentWindow = imageEditor;
|
|
break;
|
|
case "presentation" :
|
|
presentation.visible = false;
|
|
videoEditor.visible = false;
|
|
videoEditor.stop();
|
|
songEditor.visible = false;
|
|
imageEditor.visible = false;
|
|
presentationEditor.visible = true;
|
|
presentationEditor.changePresentation(item);
|
|
currentWindow = presentationEditor;
|
|
break;
|
|
default:
|
|
videoEditor.visible = false;
|
|
videoEditor.stop();
|
|
songEditor.visible = false;
|
|
imageEditor.visible = false;
|
|
presentationEditor.visible = false;
|
|
presentation.visible = true;
|
|
presentation.focusTimer = true;
|
|
currentWindow = presentation;
|
|
editMode = false;
|
|
}
|
|
} else {
|
|
videoEditor.visible = false;
|
|
videoEditor.stop();
|
|
songEditor.visible = false;
|
|
imageEditor.visible = false;
|
|
presentationEditor.visible = false;
|
|
presentation.visible = true;
|
|
presentation.focusTimer = true;
|
|
currentWindow = presentation;
|
|
editMode = false;
|
|
presenting = true;
|
|
}
|
|
}
|
|
|
|
function present(present) {
|
|
if (present)
|
|
{
|
|
presentation.loadVideo();
|
|
print("For window: Screen is: " + pWindow.screen + " And selected screen is: " + presentationScreen);
|
|
pWindow.showFullScreen();
|
|
/* pWindow.screen = presentationScreen; */
|
|
print("For window: Screen is: " + pWindow.screen + " And selected screen is: " + presentationScreen);
|
|
}
|
|
else
|
|
pWindow.close();
|
|
}
|
|
|
|
function changeVidPos(pos) {
|
|
presentation.slide.seek(pos);
|
|
pWindow.slide.seek(pos);
|
|
}
|
|
}
|