Working move, and insert, added some changing of slides functionality
This commit is contained in:
parent
105c958810
commit
9b6949090e
6 changed files with 73 additions and 51 deletions
|
@ -111,10 +111,7 @@ ColumnLayout {
|
||||||
onMoveRequested: serviceItemModel.move(oldIndex, newIndex)
|
onMoveRequested: serviceItemModel.move(oldIndex, newIndex)
|
||||||
onClicked: {
|
onClicked: {
|
||||||
serviceItemList.currentIndex = index;
|
serviceItemList.currentIndex = index;
|
||||||
/* showPassiveNotification(serviceItemList.currentIndex); */
|
changeServiceItem(index);
|
||||||
changeSlideBackground(background, backgroundType);
|
|
||||||
changeSlideText(text);
|
|
||||||
changeSlideType(type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +122,9 @@ ColumnLayout {
|
||||||
addItem(index,
|
addItem(index,
|
||||||
dragItemTitle,
|
dragItemTitle,
|
||||||
dragItemType,
|
dragItemType,
|
||||||
dragItemText,
|
|
||||||
dragItemBackgroundType,
|
|
||||||
dragItemBackground,
|
dragItemBackground,
|
||||||
|
dragItemBackgroundType,
|
||||||
|
dragItemText,
|
||||||
dragItemIndex);
|
dragItemIndex);
|
||||||
}
|
}
|
||||||
keys: ["library"]
|
keys: ["library"]
|
||||||
|
@ -152,9 +149,10 @@ ColumnLayout {
|
||||||
|
|
||||||
function addItem(index, name, type,
|
function addItem(index, name, type,
|
||||||
background, backgroundType, text, itemID) {
|
background, backgroundType, text, itemID) {
|
||||||
|
const newtext = songsqlmodel.getLyricList(itemID);
|
||||||
serviceItemModel.insertItem(index, name,
|
serviceItemModel.insertItem(index, name,
|
||||||
type, text, background,
|
type, background,
|
||||||
backgroundType)
|
backgroundType, newtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendItem(name, type, background, backgroundType, text, itemID) {
|
function appendItem(name, type, background, backgroundType, text, itemID) {
|
||||||
|
|
|
@ -133,48 +133,29 @@ Controls.Page {
|
||||||
id: serviceItemModel
|
id: serviceItemModel
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeSlideType(type) {
|
function changeServiceItem(index) {
|
||||||
presentation.itemType = type;
|
const item = serviceItemModel.getItem(index);
|
||||||
if (slideItem)
|
|
||||||
slideItem.itemType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeSlideText(text) {
|
presentation.itemType = item.type;
|
||||||
presentation.text = text;
|
|
||||||
if (slideItem)
|
|
||||||
slideItem.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeSlideBackground(background, type) {
|
if (item.backgroundType === "image") {
|
||||||
showPassiveNotification("starting background change..");
|
|
||||||
showPassiveNotification(background);
|
|
||||||
showPassiveNotification(type);
|
|
||||||
if (type == "image") {
|
|
||||||
presentation.vidbackground = "";
|
presentation.vidbackground = "";
|
||||||
presentation.imagebackground = background;
|
presentation.imagebackground = item.background;
|
||||||
if (slideItem) {
|
|
||||||
slideItem.videoSource = "";
|
|
||||||
slideItem.stopVideo();
|
|
||||||
slideItem.imageSource = background;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
presentation.imagebackground = "";
|
presentation.imagebackground = "";
|
||||||
presentation.vidbackground = background;
|
presentation.vidbackground = item.background;
|
||||||
presentation.loadVideo()
|
presentation.loadVideo()
|
||||||
if (slideItem) {
|
|
||||||
slideItem.imageSource = "";
|
|
||||||
slideItem.videoSource = background;
|
|
||||||
slideItem.loadVideo()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function changeSlideNext() {
|
if (item.text.length === 0) {
|
||||||
showPassiveNotification("next slide please")
|
presentation.text = [""];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
presentation.text = item.text;
|
||||||
|
presentation.textIndex = 0;
|
||||||
|
presentation.nextSlideText();
|
||||||
|
|
||||||
function changeSlidePrevious() {
|
print("Slide changed to: " + item.name);
|
||||||
showPassiveNotification("previous slide please")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function editSwitch(item) {
|
function editSwitch(item) {
|
||||||
|
|
|
@ -10,11 +10,14 @@ import "./" as Presenter
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string text
|
property var text
|
||||||
|
property int textIndex: 0
|
||||||
property string itemType
|
property string itemType
|
||||||
property url imagebackground
|
property url imagebackground
|
||||||
property url vidbackground
|
property url vidbackground
|
||||||
|
|
||||||
|
Component.onCompleted: nextSlideText()
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
columns: 3
|
columns: 3
|
||||||
|
@ -81,7 +84,6 @@ Item {
|
||||||
Layout.minimumWidth: 300
|
Layout.minimumWidth: 300
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
textSize: width / 15
|
textSize: width / 15
|
||||||
text: root.text
|
|
||||||
itemType: root.itemType
|
itemType: root.itemType
|
||||||
imageSource: imagebackground
|
imageSource: imagebackground
|
||||||
videoSource: vidbackground
|
videoSource: vidbackground
|
||||||
|
@ -95,7 +97,7 @@ Item {
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onPressed: changeSlideNext()
|
onPressed: nextSlideText()
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,4 +114,24 @@ Item {
|
||||||
function loadVideo() {
|
function loadVideo() {
|
||||||
previewSlide.loadVideo();
|
previewSlide.loadVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextSlideText() {
|
||||||
|
if (textIndex === 0) {
|
||||||
|
previewSlide.text = root.text[textIndex];
|
||||||
|
print(root.text[textIndex]);
|
||||||
|
textIndex++;
|
||||||
|
} else if (textIndex < root.text.length) {
|
||||||
|
previewSlide.text = root.text[textIndex];
|
||||||
|
print(root.text[textIndex]);
|
||||||
|
textIndex++;
|
||||||
|
} else {
|
||||||
|
print("Next slide time");
|
||||||
|
nextSlide();
|
||||||
|
textIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextSlide() {
|
||||||
|
print(slideItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,15 @@ Item {
|
||||||
property bool editMode: false
|
property bool editMode: false
|
||||||
|
|
||||||
// These properties are for the slides visuals
|
// These properties are for the slides visuals
|
||||||
property real textSize: 72
|
property real textSize: 50
|
||||||
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 string text: "This is demo text"
|
property var text: "This is demo text"
|
||||||
property color backgroundColor
|
property color backgroundColor
|
||||||
|
property var horizontalAlignment
|
||||||
|
property var verticalAlignment
|
||||||
|
|
||||||
//these properties are for giving video info to parents
|
//these properties are for giving video info to parents
|
||||||
property int mpvPosition: mpv.position
|
property int mpvPosition: mpv.position
|
||||||
|
@ -97,9 +99,10 @@ Item {
|
||||||
/* minimumPointSize: 5 */
|
/* minimumPointSize: 5 */
|
||||||
fontSizeMode: Text.Fit
|
fontSizeMode: Text.Fit
|
||||||
font.family: chosenFont
|
font.family: chosenFont
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
style: Text.Raised
|
style: Text.Raised
|
||||||
anchors.centerIn: parent
|
anchors.fill: parent
|
||||||
/* width: parent.width */
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
|
|
@ -121,7 +121,7 @@ void ServiceItemModel::addItem(ServiceItem *item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceItemModel::insertItem(const int &index, ServiceItem *item) {
|
void ServiceItemModel::insertItem(const int &index, ServiceItem *item) {
|
||||||
beginInsertRows(this->index(index), index, index);
|
beginInsertRows(this->index(index).parent(), index, index);
|
||||||
m_items.insert(index, item);
|
m_items.insert(index, item);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
qDebug() << "Success";
|
qDebug() << "Success";
|
||||||
|
@ -164,7 +164,7 @@ void ServiceItemModel::insertItem(const int &index, const QString &name, const Q
|
||||||
const QStringList &text) {
|
const QStringList &text) {
|
||||||
ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
ServiceItem *item = new ServiceItem(name, type, background, backgroundType, text);
|
||||||
insertItem(index, item);
|
insertItem(index, item);
|
||||||
qDebug() << name << type << background;
|
qDebug() << name << type << background << text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServiceItemModel::removeItem(int index) {
|
void ServiceItemModel::removeItem(int index) {
|
||||||
|
@ -188,3 +188,20 @@ bool ServiceItemModel::move(int sourceIndex, int destIndex) {
|
||||||
// qDebug() << success;
|
// qDebug() << success;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap ServiceItemModel::getItem(int index) const {
|
||||||
|
QVariantMap data;
|
||||||
|
const QModelIndex idx = this->index(index,0);
|
||||||
|
qDebug() << idx;
|
||||||
|
if( !idx.isValid() )
|
||||||
|
return data;
|
||||||
|
const QHash<int,QByteArray> rn = roleNames();
|
||||||
|
qDebug() << rn;
|
||||||
|
QHashIterator<int,QByteArray> it(rn);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
qDebug() << it.key() << ":" << it.value();
|
||||||
|
data[it.value()] = idx.data(it.key());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
const QString &backgroundType, const QStringList &text);
|
const QString &backgroundType, const QStringList &text);
|
||||||
Q_INVOKABLE void removeItem(int index);
|
Q_INVOKABLE void removeItem(int index);
|
||||||
Q_INVOKABLE bool move(int sourceIndex, int destIndex);
|
Q_INVOKABLE bool move(int sourceIndex, int destIndex);
|
||||||
|
Q_INVOKABLE QVariantMap getItem(int index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<ServiceItem *> m_items;
|
QList<ServiceItem *> m_items;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue