diff --git a/src/qml/presenter/MainWindow.qml b/src/qml/presenter/MainWindow.qml index 322bf84..ee4e7bf 100644 --- a/src/qml/presenter/MainWindow.qml +++ b/src/qml/presenter/MainWindow.qml @@ -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); diff --git a/src/qml/presenter/Presentation.qml b/src/qml/presenter/Presentation.qml index d7ce73a..20738be 100644 --- a/src/qml/presenter/Presentation.qml +++ b/src/qml/presenter/Presentation.qml @@ -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(); } } diff --git a/src/serviceitemmodel.cpp b/src/serviceitemmodel.cpp index d956131..3711def 100644 --- a/src/serviceitemmodel.cpp +++ b/src/serviceitemmodel.cpp @@ -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() << ActiveRole); + } + } + + item->setActive(true); + qDebug() << "################"; + qDebug() << "activated" << item->name(); + qDebug() << "################"; + emit dataChanged(idx, idx, QVector() << ActiveRole); + return true; +} diff --git a/src/serviceitemmodel.h b/src/serviceitemmodel.h index 72eb153..a2c4fac 100644 --- a/src/serviceitemmodel.h +++ b/src/serviceitemmodel.h @@ -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: