adding a presentmode
This commit is contained in:
parent
2496f6708a
commit
d647f4442f
12 changed files with 534 additions and 590 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -12,6 +12,9 @@ Item {
|
||||||
|
|
||||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Kirigami.Theme.backgroundColor
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
@ -77,10 +80,11 @@ Item {
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: itemDelegate
|
id: itemDelegate
|
||||||
|
|
||||||
Kirigami.BasicListItem {
|
Kirigami.BasicListItem {
|
||||||
id: songListItem
|
id: songListItem
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
height:40
|
height: 40
|
||||||
label: title
|
label: title
|
||||||
subtitle: author
|
subtitle: author
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
@ -93,10 +97,6 @@ Item {
|
||||||
showPassiveNotification(songLyrics, 3000)
|
showPassiveNotification(songLyrics, 3000)
|
||||||
}
|
}
|
||||||
|
|
||||||
Drag.active: dragHandler.drag.active
|
|
||||||
Drag.hotSpot.x: width / 2
|
|
||||||
Drag.hotSpot.y: height / 2
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: dragHandler
|
id: dragHandler
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -110,6 +110,9 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Drag.active: dragHandler.drag.active
|
||||||
|
Drag.hotSpot.x: width / 2
|
||||||
|
Drag.hotSpot.y: height / 2
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "dragged"
|
name: "dragged"
|
||||||
|
@ -366,25 +369,6 @@ Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* 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 */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
67
src/qml/presenter/Presentation.qml
Normal file
67
src/qml/presenter/Presentation.qml
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,6 +95,16 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controls.SplitView {
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Controls.SplitView.fillHeight: true
|
||||||
|
Controls.SplitView.preferredWidth: 500
|
||||||
|
Controls.SplitView.minimumWidth: 500
|
||||||
|
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
id: songTitleField
|
id: songTitleField
|
||||||
|
|
||||||
|
@ -105,15 +118,6 @@ Item {
|
||||||
padding: 10
|
padding: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: slideBar
|
|
||||||
color: Kirigami.Theme.highlightColor
|
|
||||||
|
|
||||||
Layout.preferredWidth: 700
|
|
||||||
Layout.preferredHeight: songTitleField.height
|
|
||||||
Layout.rightMargin: 20
|
|
||||||
}
|
|
||||||
|
|
||||||
Controls.ScrollView {
|
Controls.ScrollView {
|
||||||
id: songLyricsField
|
id: songLyricsField
|
||||||
|
|
||||||
|
@ -136,16 +140,6 @@ Item {
|
||||||
onPressed: editorTimer.running = true
|
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 {
|
Controls.TextField {
|
||||||
id: songAuthorField
|
id: songAuthorField
|
||||||
|
|
||||||
|
@ -158,8 +152,36 @@ Item {
|
||||||
text: songAuthor
|
text: songAuthor
|
||||||
padding: 10
|
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 {
|
Timer {
|
||||||
id: editorTimer
|
id: editorTimer
|
||||||
interval: 2000
|
interval: 2000
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -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
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
|
@ -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
|
|
Loading…
Add table
Add a link
Reference in a new issue