adding a presentmode

This commit is contained in:
Chris Cochrun 2022-02-20 07:29:41 -06:00
parent 2496f6708a
commit d647f4442f
12 changed files with 534 additions and 590 deletions

View file

@ -13,6 +13,7 @@ Kirigami.ApplicationWindow {
property bool libraryOpen: true property bool libraryOpen: true
property bool presenting: false property bool presenting: false
property bool presentMode: true
property var secondScreen: null property var secondScreen: null
pageStack.initialPage: mainPage pageStack.initialPage: mainPage
@ -30,6 +31,7 @@ Kirigami.ApplicationWindow {
Component.onCompleted: { Component.onCompleted: {
print("checking screens") print("checking screens")
print("Present Mode is " + presentMode)
secondScreen = Qt.application.screens[1] secondScreen = Qt.application.screens[1]
print(secondScreen) print(secondScreen)
} }

View file

@ -29,6 +29,12 @@ Kirigami.ActionToolBar {
} }
}, },
Kirigami.Action {
icon.name: "edit"
text: presentMode ? "Edit" : "Preview"
onTriggered: presentMode = !presentMode
},
Kirigami.Action { Kirigami.Action {
icon.name: "view-presentation" icon.name: "view-presentation"
text: "Go Live" text: "Go Live"

View file

@ -12,379 +12,363 @@ Item {
Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.colorSet: Kirigami.Theme.View
ColumnLayout { Rectangle {
anchors.fill: parent anchors.fill: parent
spacing: 0 color: Kirigami.Theme.backgroundColor
Rectangle { ColumnLayout {
id: songLibraryPanel anchors.fill: parent
Layout.preferredHeight: 40 spacing: 0
Layout.fillWidth: true Rectangle {
color: Kirigami.Theme.backgroundColor id: songLibraryPanel
Layout.preferredHeight: 40
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
Controls.Label { Controls.Label {
anchors.centerIn: parent anchors.centerIn: parent
text: "Songs" text: "Songs"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "songs")
selectedLibrary = ""
else
selectedLibrary = "songs"
print(selectedLibrary)
} }
}
}
ListView { MouseArea {
Layout.fillHeight: true anchors.fill: parent
Layout.fillWidth: true
id: songLibraryList
model: _songListModel
delegate: itemDelegate
state: "selected"
Component.onCompleted: print(selectedLibrary)
states: [
State {
name: "deselected"
when: (selectedLibrary !== "songs")
PropertyChanges { target: songLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "songs")
PropertyChanges { target: songLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: songLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
}
}
Component {
id: itemDelegate
Kirigami.BasicListItem {
id: songListItem
width: ListView.view.width
height:40
label: title
subtitle: author
hoverEnabled: true
onClicked: { onClicked: {
ListView.view.currentIndex = index if (selectedLibrary == "songs")
song = ListView.view.selected selectedLibrary = ""
songTitle = title else
songLyrics = lyrics selectedLibrary = "songs"
songAuthor = author print(selectedLibrary)
showPassiveNotification(songLyrics, 3000)
} }
}
}
Drag.active: dragHandler.drag.active ListView {
Drag.hotSpot.x: width / 2 Layout.fillHeight: true
Drag.hotSpot.y: height / 2 Layout.fillWidth: true
id: songLibraryList
model: _songListModel
delegate: itemDelegate
state: "selected"
MouseArea { Component.onCompleted: print(selectedLibrary)
id: dragHandler
anchors.fill: parent states: [
drag { State {
target: songListItem name: "deselected"
onActiveChanged: { when: (selectedLibrary !== "songs")
if (dragHandler.drag.active) { PropertyChanges { target: songLibraryList
draggedLibraryItem = songLibraryList.currentItem height: 0
showPassiveNotification(index) Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "songs")
PropertyChanges { target: songLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: songLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
}
}
Component {
id: itemDelegate
Kirigami.BasicListItem {
id: songListItem
width: ListView.view.width
height: 40
label: title
subtitle: author
hoverEnabled: true
onClicked: {
ListView.view.currentIndex = index
song = ListView.view.selected
songTitle = title
songLyrics = lyrics
songAuthor = author
showPassiveNotification(songLyrics, 3000)
}
MouseArea {
id: dragHandler
anchors.fill: parent
drag {
target: songListItem
onActiveChanged: {
if (dragHandler.drag.active) {
draggedLibraryItem = songLibraryList.currentItem
showPassiveNotification(index)
}
} }
} }
} }
} Drag.active: dragHandler.drag.active
Drag.hotSpot.x: width / 2
Drag.hotSpot.y: height / 2
states: State { states: State {
name: "dragged" name: "dragged"
when: songListItem.Drag.active when: songListItem.Drag.active
PropertyChanges { PropertyChanges {
target: songListItem target: songListItem
x: x x: x
y: y y: y
}
} }
} }
} }
}
Kirigami.WheelHandler { Kirigami.WheelHandler {
id: wheelHandler id: wheelHandler
target: songLibraryList target: songLibraryList
filterMouseEvents: true filterMouseEvents: true
keyNavigationEnabled: true keyNavigationEnabled: true
}
Controls.ScrollBar.vertical: Controls.ScrollBar {
anchors.right: songLibraryList.right
anchors.leftMargin: 10
active: hovered || pressed
}
}
Rectangle {
id: videoLibraryPanel
Layout.preferredHeight: 40
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
Controls.Label {
anchors.centerIn: parent
text: "Videos"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "videos")
selectedLibrary = ""
else
selectedLibrary = "videos"
print(selectedLibrary)
} }
}
}
ListView { Controls.ScrollBar.vertical: Controls.ScrollBar {
id: videoLibraryList anchors.right: songLibraryList.right
Layout.fillHeight: true anchors.leftMargin: 10
Layout.fillWidth: true active: hovered || pressed
state: "deselected"
states: [
State {
name: "deselected"
when: (selectedLibrary !== "videos")
PropertyChanges { target: videoLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "videos")
PropertyChanges { target: videoLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: videoLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
}
}
}
Rectangle {
id: imageLibraryPanel
Layout.preferredHeight: 40
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
Controls.Label {
anchors.centerIn: parent
text: "Images"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "images")
selectedLibrary = ""
else
selectedLibrary = "images"
print(selectedLibrary)
}
}
}
ListView {
id: imageLibraryList
Layout.fillHeight: true
Layout.fillWidth: true
state: "deselected"
states: [
State {
name: "deselected"
when: (selectedLibrary !== "images")
PropertyChanges { target: imageLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "images")
PropertyChanges { target: imageLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: imageLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
} }
} }
} Rectangle {
Rectangle { id: videoLibraryPanel
id: presentationLibraryPanel Layout.preferredHeight: 40
Layout.preferredHeight: 40 Layout.fillWidth: true
Layout.fillWidth: true color: Kirigami.Theme.backgroundColor
color: Kirigami.Theme.backgroundColor
Controls.Label { Controls.Label {
anchors.centerIn: parent anchors.centerIn: parent
text: "Presentations" text: "Videos"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "presentations")
selectedLibrary = ""
else
selectedLibrary = "presentations"
print(selectedLibrary)
} }
}
}
ListView { MouseArea {
id: presentationLibraryList anchors.fill: parent
Layout.fillHeight: true onClicked: {
Layout.fillWidth: true if (selectedLibrary == "videos")
state: "deselected" selectedLibrary = ""
else
states: [ selectedLibrary = "videos"
State { print(selectedLibrary)
name: "deselected" }
when: (selectedLibrary !== "presentations")
PropertyChanges { target: presentationLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "presentations")
PropertyChanges { target: presentationLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: presentationLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
} }
} }
} ListView {
Rectangle { id: videoLibraryList
id: slideLibraryPanel Layout.fillHeight: true
Layout.preferredHeight: 40 Layout.fillWidth: true
Layout.fillWidth: true state: "deselected"
color: Kirigami.Theme.backgroundColor
Controls.Label { states: [
anchors.centerIn: parent State {
text: "Slides" name: "deselected"
} when: (selectedLibrary !== "videos")
PropertyChanges { target: videoLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "videos")
PropertyChanges { target: videoLibraryList }
}
]
MouseArea { transitions: Transition {
anchors.fill: parent to: "*"
onClicked: { NumberAnimation {
if (selectedLibrary == "slides") target: videoLibraryList
selectedLibrary = "" properties: "height"
else easing.type: Easing.OutCubic
selectedLibrary = "slides" duration: 300
print(selectedLibrary) }
}
}
}
ListView {
id: slideLibraryList
Layout.fillHeight: true
Layout.fillWidth: true
state: "deselected"
states: [
State {
name: "deselected"
when: (selectedLibrary !== "slides")
PropertyChanges { target: slideLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "slides")
PropertyChanges { target: slideLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: slideLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
} }
} }
} Rectangle {
id: imageLibraryPanel
Layout.preferredHeight: 40
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
Controls.Label {
anchors.centerIn: parent
text: "Images"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "images")
selectedLibrary = ""
else
selectedLibrary = "images"
print(selectedLibrary)
}
}
}
ListView {
id: imageLibraryList
Layout.fillHeight: true
Layout.fillWidth: true
state: "deselected"
states: [
State {
name: "deselected"
when: (selectedLibrary !== "images")
PropertyChanges { target: imageLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "images")
PropertyChanges { target: imageLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: imageLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
}
}
}
Rectangle {
id: presentationLibraryPanel
Layout.preferredHeight: 40
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
Controls.Label {
anchors.centerIn: parent
text: "Presentations"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "presentations")
selectedLibrary = ""
else
selectedLibrary = "presentations"
print(selectedLibrary)
}
}
}
ListView {
id: presentationLibraryList
Layout.fillHeight: true
Layout.fillWidth: true
state: "deselected"
states: [
State {
name: "deselected"
when: (selectedLibrary !== "presentations")
PropertyChanges { target: presentationLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "presentations")
PropertyChanges { target: presentationLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: presentationLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
}
}
}
Rectangle {
id: slideLibraryPanel
Layout.preferredHeight: 40
Layout.fillWidth: true
color: Kirigami.Theme.backgroundColor
Controls.Label {
anchors.centerIn: parent
text: "Slides"
}
MouseArea {
anchors.fill: parent
onClicked: {
if (selectedLibrary == "slides")
selectedLibrary = ""
else
selectedLibrary = "slides"
print(selectedLibrary)
}
}
}
ListView {
id: slideLibraryList
Layout.fillHeight: true
Layout.fillWidth: true
state: "deselected"
states: [
State {
name: "deselected"
when: (selectedLibrary !== "slides")
PropertyChanges { target: slideLibraryList
height: 0
Layout.fillHeight: false
visible: false
}
},
State {
name: "selected"
when: (selectedLibrary == "slides")
PropertyChanges { target: slideLibraryList }
}
]
transitions: Transition {
to: "*"
NumberAnimation {
target: slideLibraryList
properties: "height"
easing.type: Easing.OutCubic
duration: 300
}
}
}
}
} }
/* Presenter.LibraryItem { */
/* id: songLibrary */
/* title: "Songs" */
/* model: _songListModel */
/* open: true */
/* /\* type: "song" *\/ */
/* width: parent.width */
/* anchors.top: parent.top */
/* } */
/* Presenter.LibraryItem { */
/* id: ssongLibrary */
/* title: "Songs" */
/* model: _songListModel */
/* open: false */
/* width: parent.width */
/* /\* type: "song" *\/ */
/* anchors.top: songLibrary.bottom */
/* } */
} }

View file

@ -11,6 +11,8 @@ import "./" as Presenter
Controls.Page { Controls.Page {
id: mainPage id: mainPage
padding: 0 padding: 0
// properties passed around for the slides
property url imageBackground: "" property url imageBackground: ""
property url videoBackground: "" property url videoBackground: ""
property var song property var song
@ -18,6 +20,9 @@ Controls.Page {
property string songLyrics: "" property string songLyrics: ""
property string songAuthor: "" property string songAuthor: ""
property int blurRadius: 0 property int blurRadius: 0
property Item slideItem
property var draggedLibraryItem property var draggedLibraryItem
Item { Item {
@ -29,14 +34,11 @@ Controls.Page {
anchors.fill: parent anchors.fill: parent
handle: Item{ handle: Item{
implicitWidth: 6 implicitWidth: 6
Rectangle { Rectangle {
height: parent.height height: parent.height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
implicitWidth: 2 implicitWidth: 1
color: Controls.SplitHandle.hovered ? Kirigami.Theme.hoverColor : Kirigami.Theme.backgroundColor color: Controls.SplitHandle.hovered ? Kirigami.Theme.hoverColor : Kirigami.Theme.backgroundColor
//Controls.SplitHandle.pressed ? Kirigami.Theme.focusColor
//: (Controls.Splithandle.hovered ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor)
} }
} }
@ -48,13 +50,21 @@ Controls.Page {
} }
Presenter.SongEditor { Presenter.SongEditor {
id: rightMainArea id: songEditor
Controls.SplitView.fillHeight: true Controls.SplitView.fillHeight: true
Controls.SplitView.fillWidth: true Controls.SplitView.fillWidth: true
Controls.SplitView.preferredWidth: 700 Controls.SplitView.preferredWidth: 700
Controls.SplitView.minimumWidth: 500 Controls.SplitView.minimumWidth: 500
} }
/* Presenter.Presentation { */
/* id: presentation */
/* Controls.SplitView.fillHeight: true */
/* Controls.SplitView.fillWidth: true */
/* Controls.SplitView.preferredWidth: 700 */
/* Controls.SplitView.minimumWidth: 500 */
/* } */
Presenter.Library { Presenter.Library {
id: library id: library
Controls.SplitView.fillHeight: true Controls.SplitView.fillHeight: true
@ -63,7 +73,6 @@ Controls.Page {
} }
} }
} }
Loader { Loader {
@ -76,14 +85,18 @@ Controls.Page {
width: maximumWidth width: maximumWidth
screen: secondScreen screen: secondScreen
onClosing: presenting = false onClosing: presenting = false
Component.onCompleted: { Component.onCompleted: {
presentationWindow.showFullScreen(); presentationWindow.showFullScreen();
print(Qt.application.screens[1]) print(Qt.application.screens[1])
} }
Presenter.Slide { Presenter.Slide {
id: presentationSlide id: presentationSlide
imageSource: imageBackground imageSource: imageBackground
videoSource: videoBackground videoSource: videoBackground
Component.onCompleted: slideItem = presentationSlide
} }
} }
} }

View file

@ -0,0 +1,67 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.15 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter
Item {
id: root
GridLayout {
anchors.fill: parent
columns: 3
rowSpacing: 5
columnSpacing: 0
Controls.ToolBar {
Layout.fillWidth: true
Layout.columnSpan: 3
id: toolbar
RowLayout {
anchors.fill: parent
Controls.ToolButton {
text: "Grid"
}
Controls.ToolButton {
text: "Solo"
}
Controls.ToolSeparator {}
Item { Layout.fillWidth: true }
Controls.ToolSeparator {}
Controls.ToolButton {
text: "Effects"
icon.name: "image-auto-adjust"
onClicked: {}
}
Controls.ToolButton {
id: backgroundButton
text: "Background"
icon.name: "fileopen"
onClicked: backgroundType.open()
}
}
}
Kirigami.Icon {
source: "arrow-left"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.preferredWidth: 25
}
Presenter.Slide {
Layout.preferredWidth: 50
}
Kirigami.Icon {
source: "arrow-right"
Layout.fillHeight: true
Layout.fillWidth: true
Layout.preferredWidth: 25
}
}
}

View file

@ -12,39 +12,25 @@ Item {
id: root id: root
anchors.fill: parent anchors.fill: parent
property real textSize: 26 // Let's make this slide editable
property bool editMode: false property bool editMode: false
// These properties are for the slides visuals
property real textSize: 26
property bool dropShadow: false property bool dropShadow: false
property url imageSource: imageBackground property url imageSource: imageBackground
property url videoSource: videoBackground property url videoSource: videoBackground
property string chosenFont: "Quicksand" property string chosenFont: "Quicksand"
property color backgroundColor property color backgroundColor
// These properties help to determine the state of the slide
property string itemType
Rectangle { Rectangle {
id: basePrColor id: basePrColor
anchors.fill: parent anchors.fill: parent
color: "black" color: "black"
/* MediaPlayer { */
/* id: mediaPlayer */
/* source: videoSource */
/* loops: MediaPlayer.Infinite */
/* autoPlay: editMode ? false : true */
/* notifyInterval: 100 */
/* } */
/* VideoOutput { */
/* id: videoPlayer */
/* anchors.fill: parent */
/* source: mediaPlayer */
/* /\* flushMode: VideoOutput.LastFrame *\/ */
/* MouseArea { */
/* id: playArea */
/* anchors.fill: parent */
/* onPressed: mediaPlayer.play(); */
/* } */
/* } */
MpvObject { MpvObject {
id: mpv id: mpv
objectName: "mpv" objectName: "mpv"
@ -60,15 +46,17 @@ Item {
MouseArea { MouseArea {
id: playArea id: playArea
anchors.fill: parent anchors.fill: parent
enabled: editMode
onPressed: mpv.loadFile(videoSource.toString()); onPressed: mpv.loadFile(videoSource.toString());
} }
/* Controls.ProgressBar { */ Controls.ProgressBar {
/* anchors.centerIn: parent */ anchors.centerIn: parent
/* width: parent.width - 400 */ visible: editMode
/* value: mpv.position */ width: parent.width - 400
/* to: mpv.duration */ value: mpv.position
/* } */ to: mpv.duration
}
} }
Timer { Timer {
@ -111,7 +99,10 @@ Item {
color: "#80000000" color: "#80000000"
} }
} }
} }
} }
function changeText(text) {
lyrics.text = text
}
} }

View file

@ -3,7 +3,6 @@ import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.15 as Controls import QtQuick.Controls 2.15 as Controls
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 QtAudioEngine 1.15 import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter import "./" as Presenter
@ -65,11 +64,15 @@ Item {
id: backgroundType id: backgroundType
x: backgroundButton.x x: backgroundButton.x
y: backgroundButton.y + backgroundButton.height + 20 y: backgroundButton.y + backgroundButton.height + 20
width: 200
height: 100
modal: true modal: true
focus: true focus: true
dim: false dim: false
background: Rectangle {
Kirigami.Theme.colorSet: Kirigami.Theme.Tooltip
color: Kirigami.Theme.backgroundColor
border.color: Kirigami.Theme.activeBackgroundColor
border.width: 2
}
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@ -92,79 +95,98 @@ Item {
} }
} }
Controls.TextField { Controls.SplitView {
id: songTitleField
Layout.preferredWidth: 300
Layout.fillWidth: true
Layout.leftMargin: 20
Layout.rightMargin: 20
placeholderText: "Song Title..."
text: songTitle
padding: 10
}
Rectangle {
id: slideBar
color: Kirigami.Theme.highlightColor
Layout.preferredWidth: 700
Layout.preferredHeight: songTitleField.height
Layout.rightMargin: 20
}
Controls.ScrollView {
id: songLyricsField
Layout.preferredHeight: 3000
Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.leftMargin: 20
rightPadding: 20
Controls.TextArea {
width: parent.width
placeholderText: "Put lyrics here..."
persistentSelection: true
text: songLyrics
textFormat: TextEdit.MarkdownText
padding: 10
onEditingFinished: song.lyricsSlides(text)
onPressed: editorTimer.running = true
}
}
Presenter.SlideEditor {
id: slideEditor
Layout.preferredWidth: 700
Layout.preferredHeight: 394
Layout.bottomMargin: 30
Layout.rightMargin: 20
Layout.rowSpan: 2
}
Controls.TextField {
id: songAuthorField
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: 300 Layout.columnSpan: 2
Layout.leftMargin: 20
Layout.rightMargin: 20
placeholderText: "Author..." ColumnLayout {
text: songAuthor Controls.SplitView.fillHeight: true
padding: 10 Controls.SplitView.preferredWidth: 500
} Controls.SplitView.minimumWidth: 500
Controls.TextField {
id: songTitleField
Layout.preferredWidth: 300
Layout.fillWidth: true
Layout.leftMargin: 20
Layout.rightMargin: 20
placeholderText: "Song Title..."
text: songTitle
padding: 10
}
Controls.ScrollView {
id: songLyricsField
Layout.preferredHeight: 3000
Layout.fillWidth: true
Layout.fillHeight: true
Layout.leftMargin: 20
rightPadding: 20
Controls.TextArea {
width: parent.width
placeholderText: "Put lyrics here..."
persistentSelection: true
text: songLyrics
textFormat: TextEdit.MarkdownText
padding: 10
onEditingFinished: song.lyricsSlides(text)
onPressed: editorTimer.running = true
}
}
Controls.TextField {
id: songAuthorField
Layout.fillWidth: true
Layout.preferredWidth: 300
Layout.leftMargin: 20
Layout.rightMargin: 20
placeholderText: "Author..."
text: songAuthor
padding: 10
}
}
ColumnLayout {
Controls.SplitView.fillHeight: true
Controls.SplitView.preferredWidth: 500
Controls.SplitView.minimumWidth: 300
Rectangle {
id: slideBar
color: Kirigami.Theme.highlightColor
Layout.preferredWidth: 500
Layout.preferredHeight: songTitleField.height
Layout.rightMargin: 20
Layout.leftMargin: 20
}
Presenter.SlideEditor {
id: slideEditor
Layout.preferredWidth: 500
Layout.preferredHeight: 292
Layout.bottomMargin: 30
Layout.rightMargin: 20
Layout.leftMargin: 20
}
}
} }
Timer { }
id: editorTimer Timer {
interval: 2000 id: editorTimer
repeat: true interval: 2000
running: false repeat: true
onTriggered: showPassiveNotification("updating song...") running: false
onTriggered: showPassiveNotification("updating song...")
} }
} }

View file

@ -15,6 +15,7 @@
<file>qml/presenter/Slide.qml</file> <file>qml/presenter/Slide.qml</file>
<file>qml/presenter/SlideEditor.qml</file> <file>qml/presenter/SlideEditor.qml</file>
<file>qml/presenter/DragHandle.qml</file> <file>qml/presenter/DragHandle.qml</file>
<file>qml/presenter/Presentation.qml</file>
<file>assets/parallel.jpg</file> <file>assets/parallel.jpg</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -1,57 +0,0 @@
#include "serviceitem.h"
ServiceItem::ServiceItem(QObject *parent)
: QAbstractListModel(parent)
{
}
int ServiceItem::rowCount(const QModelIndex &parent) const
{
// For list models only the root node (an invalid parent) should return the list's size. For all
// other (valid) parents, rowCount() should return 0 so that it does not become a tree model.
if (parent.isValid())
return 0;
// FIXME: Implement me!
}
QVariant ServiceItem::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
// FIXME: Implement me!
return QVariant();
}
bool ServiceItem::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (data(index, role) != value) {
// FIXME: Implement me!
emit dataChanged(index, index, QVector<int>() << role);
return true;
}
return false;
}
Qt::ItemFlags ServiceItem::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::NoItemFlags;
return Qt::ItemIsEditable; // FIXME: Implement me!
}
bool ServiceItem::insertRows(int row, int count, const QModelIndex &parent)
{
beginInsertRows(parent, row, row + count - 1);
// FIXME: Implement me!
endInsertRows();
}
bool ServiceItem::removeRows(int row, int count, const QModelIndex &parent)
{
beginRemoveRows(parent, row, row + count - 1);
// FIXME: Implement me!
endRemoveRows();
}

View file

@ -1,33 +0,0 @@
#ifndef SERVICEITEM_H
#define SERVICEITEM_H
#include <QAbstractListModel>
class ServiceItem : public QAbstractListModel
{
Q_OBJECT
public:
explicit ServiceItem(QObject *parent = nullptr);
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
// Editable:
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
// Add data:
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
// Remove data:
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
private:
};
#endif // SERVICEITEM_H

View file

@ -1,25 +0,0 @@
#include "songtext.h"
SongText::SongText(QObject *parent) :
QObject(parent)
{
}
QString SongText::songText()
{
return m_songText;
}
void SongText::setSongText(const QString &songText)
{
if (songText == m_songText)
return;
QTextStream stream(&songText);
QString line = stream.readLine();
qDebug() << line;
m_songText = songText;
emit songTextChanged();
}

View file

@ -1,27 +0,0 @@
#ifndef SONGTEXT_H
#define SONGTEXT_H
#include <QObject>
#include <QString>
#include <qqml.h>
class SongText : public QObject
{
Q_OBJECT
Q_PROPERTY(QString songText READ songText WRITE setSongText NOTIFY songTextChanged)
QML_ELEMENT
public:
explicit SongText(QObject *parent = nullptr);
QString songText();
void setSongText(const QString &lyrics);
signals:
void songTextChanged();
private:
QString m_songText;
};
#endif // SONGTEXT_H