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