making preview of slides aware of being active and set first item
This commit is contained in:
parent
56086dfe74
commit
ace9da585a
4 changed files with 78 additions and 17 deletions
|
@ -41,7 +41,7 @@ Controls.Page {
|
|||
|
||||
property string editType
|
||||
|
||||
Component.onCompleted: refocusTimer.start()
|
||||
Component.onCompleted: {refocusTimer.start(); changeServiceItem(0);}
|
||||
Item {
|
||||
id: mainItem
|
||||
anchors.fill: parent
|
||||
|
@ -160,6 +160,7 @@ Controls.Page {
|
|||
/* presentation.itemType = item.type; */
|
||||
print("Time to start changing");
|
||||
|
||||
serviceItemModel.activate(index);
|
||||
SlideObject.changeSlide(item);
|
||||
|
||||
/* if (item.backgroundType === "video") */
|
||||
|
@ -168,6 +169,7 @@ Controls.Page {
|
|||
/* } */
|
||||
|
||||
presentation.textIndex = 0;
|
||||
serviceItemModel.select(index);
|
||||
/* presentation.changeSlide(); */
|
||||
|
||||
print("Slide changed to: " + item.name);
|
||||
|
|
|
@ -158,24 +158,56 @@ Item {
|
|||
Layout.fillHeight: true
|
||||
Layout.columnSpan: 3
|
||||
orientation: ListView.Horizontal
|
||||
cacheBuffer: 900
|
||||
reuseItems: true
|
||||
|
||||
model: serviceItemModel
|
||||
delegate: Presenter.Slide {
|
||||
id: previewSlide
|
||||
implicitWidth: 200
|
||||
delegate: Rectangle {
|
||||
id: previewHighlight
|
||||
implicitWidth: 210
|
||||
implicitHeight: width / 16 * 9
|
||||
/* Layout.alignment: Qt.AlignCenter */
|
||||
textSize: width / 15
|
||||
itemType: root.itemType
|
||||
imageSource: background
|
||||
videoSource: background
|
||||
audioSource: audio
|
||||
chosenFont: font
|
||||
text: text
|
||||
pdfIndex: 0
|
||||
preview: true
|
||||
editMode: true
|
||||
color: active ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
|
||||
|
||||
Presenter.Slide {
|
||||
id: previewSlideItem
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: 200
|
||||
implicitHeight: width / 16 * 9
|
||||
textSize: width / 15
|
||||
itemType: type
|
||||
imageSource: backgroundType === "image" ? background : ""
|
||||
videoSource: backgroundType === "video" ? background : ""
|
||||
audioSource: ""
|
||||
chosenFont: font
|
||||
text: text
|
||||
pdfIndex: 0
|
||||
preview: true
|
||||
editMode: true
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
id: slidesTitle
|
||||
width: previewSlideItem.width
|
||||
anchors.top: previewSlideItem.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.topMargin: 5
|
||||
elide: Text.ElideRight
|
||||
text: name
|
||||
/* font.family: "Quicksand Bold" */
|
||||
}
|
||||
}
|
||||
Kirigami.WheelHandler {
|
||||
id: wheelHandler
|
||||
target: previewSlidesList
|
||||
filterMouseEvents: true
|
||||
}
|
||||
|
||||
}
|
||||
Item {
|
||||
/* Layout.preferredHeight: 200 */
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 3
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -204,12 +236,12 @@ Item {
|
|||
}
|
||||
|
||||
function loadVideo() {
|
||||
showPassiveNotification("Loading Video " + vidbackground)
|
||||
/* showPassiveNotification("Loading Video " + vidbackground) */
|
||||
previewSlide.loadVideo();
|
||||
}
|
||||
|
||||
function stopVideo() {
|
||||
showPassiveNotification("Stopping Video")
|
||||
/* showPassiveNotification("Stopping Video") */
|
||||
previewSlide.stopVideo()
|
||||
}
|
||||
|
||||
|
@ -225,6 +257,7 @@ Item {
|
|||
print(changed);
|
||||
if (changed) {
|
||||
currentServiceItem++;
|
||||
changeServiceItem(currentServiceItem);
|
||||
leftDock.changeItem();
|
||||
}
|
||||
}
|
||||
|
@ -247,6 +280,7 @@ Item {
|
|||
print(changed);
|
||||
if (changed) {
|
||||
currentServiceItem--;
|
||||
changeServiceItem(currentServiceItem);
|
||||
leftDock.changeItem();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -381,3 +381,27 @@ bool ServiceItemModel::select(int id) {
|
|||
qDebug() << "################";
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ServiceItemModel::activate(int id) {
|
||||
QModelIndex idx = index(id);
|
||||
ServiceItem *item = m_items[idx.row()];
|
||||
|
||||
for (int i = 0; i < m_items.length(); i++) {
|
||||
QModelIndex idx = index(i);
|
||||
ServiceItem *itm = m_items[idx.row()];
|
||||
if (itm->active()) {
|
||||
itm->setActive(false);
|
||||
qDebug() << "################";
|
||||
qDebug() << "deactivated" << itm->name();
|
||||
qDebug() << "################";
|
||||
emit dataChanged(idx, idx, QVector<int>() << ActiveRole);
|
||||
}
|
||||
}
|
||||
|
||||
item->setActive(true);
|
||||
qDebug() << "################";
|
||||
qDebug() << "activated" << item->name();
|
||||
qDebug() << "################";
|
||||
emit dataChanged(idx, idx, QVector<int>() << ActiveRole);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ public:
|
|||
Q_INVOKABLE bool moveDown(int index);
|
||||
Q_INVOKABLE bool moveUp(int index);
|
||||
Q_INVOKABLE bool select(int id);
|
||||
Q_INVOKABLE bool activate(int id);
|
||||
Q_INVOKABLE QVariantMap getItem(int index) const;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue