more bugfixes

This commit is contained in:
Chris Cochrun 2025-07-28 07:13:00 -05:00
parent ba3c9dc183
commit 5ba657a7d4
7 changed files with 33 additions and 27 deletions

View file

@ -225,7 +225,8 @@ ColumnLayout {
implicitWidth: libraryList.width implicitWidth: libraryList.width
height: selectedLibrary == libraryType ? 50 : 0 height: selectedLibrary == libraryType ? 50 : 0
property bool rightMenu: false property bool rightMenu: false
property bool selected: selectionModel.hasSelection && selectionModel.currentIndex == innerModel.index(index, 0) property bool selected: selectionModel.hasSelection &&
selectionModel.isSelected(innerModel.index(index, 0))
property bool fileValidation: { property bool fileValidation: {
if (filePath) if (filePath)
fileHelper.validate(filePath) fileHelper.validate(filePath)
@ -250,7 +251,7 @@ ColumnLayout {
implicitWidth: libraryList.width implicitWidth: libraryList.width
height: selectedLibrary == libraryType ? 50 : 0 height: selectedLibrary == libraryType ? 50 : 0
spacing: Kirigami.Unit.gridUnit * 2.0 spacing: Kirigami.Units.gridUnit * 2.0
Controls.Label { Controls.Label {
id: itemTitle id: itemTitle
anchors.top: parent.top anchors.top: parent.top
@ -273,9 +274,7 @@ ColumnLayout {
} }
Binding on color { Binding on color {
when: dragHandler.containsMouse || when: dragHandler.containsMouse || selected
(selectionModel.hasSelection &&
selectionModel.isSelected(proxyModel.idx(index)))
value: Kirigami.Theme.highlightedTextColor value: Kirigami.Theme.highlightedTextColor
} }
} }
@ -309,9 +308,7 @@ ColumnLayout {
} }
Binding on color { Binding on color {
when: dragHandler.containsMouse || when: dragHandler.containsMouse || selected
(selectionModel.hasSelection &&
selectionModel.isSelected(proxyModel.idx(index)))
value: Kirigami.Theme.highlightedTextColor value: Kirigami.Theme.highlightedTextColor
} }
} }
@ -325,9 +322,7 @@ ColumnLayout {
source: itemIcon source: itemIcon
Binding on color { Binding on color {
when: dragHandler.containsMouse || when: dragHandler.containsMouse || selected
(selectionModel.hasSelection &&
selectionModel.isSelected(proxyModel.idx(index)))
value: Kirigami.Theme.highlightedTextColor value: Kirigami.Theme.highlightedTextColor
} }
} }
@ -420,6 +415,11 @@ ColumnLayout {
} }
} }
console.log(selectionModel.selectedIndexes); console.log(selectionModel.selectedIndexes);
} else if ((mouse.button === Qt.LeftButton) &&
(mouse.modifiers === Qt.CtrlModifier)) {
selectionModel.select(innerModel.index(index, 0),
ItemSelectionModel.Select);
libraryList.currentIndex = index;
} else { } else {
selectionModel.select(innerModel.index(index, 0), selectionModel.select(innerModel.index(index, 0),
ItemSelectionModel.ClearAndSelect); ItemSelectionModel.ClearAndSelect);
@ -473,13 +473,13 @@ ColumnLayout {
if (row > currentRow) { if (row > currentRow) {
for (var i = currentRow; i <= row; i++) { for (var i = currentRow; i <= row; i++) {
let idx = innerModel.idx(i); let idx = innerModel.index(i);
selectionModel.select(idx, ItemSelectionModel.Select); selectionModel.select(idx, ItemSelectionModel.Select);
} }
} }
else { else {
for (var i = row; i <= currentRow; i++) { for (var i = row; i <= currentRow; i++) {
let idx = innerModel.idx(i); let idx = innerModel.index(i);
selectionModel.select(idx, ItemSelectionModel.Select); selectionModel.select(idx, ItemSelectionModel.Select);
} }
} }

View file

@ -388,7 +388,7 @@ FocusScope {
id: keyHandler id: keyHandler
/* anchors.fill: parent */ /* anchors.fill: parent */
focus: true focus: true
Keys.onPressed: { Keys.onPressed: (event) => {
if (event.key == Qt.Key_J) if (event.key == Qt.Key_J)
nextSlideAction(); nextSlideAction();
if (event.key == Qt.Key_L) if (event.key == Qt.Key_L)
@ -486,7 +486,8 @@ FocusScope {
function nextSlideAction() { function nextSlideAction() {
keyHandler.forceActiveFocus(); keyHandler.forceActiveFocus();
SlideModel.next() SlideModel.next();
Utils.dbg("Slide type: " + SlideObject.ty);
/* const nextSlideIdx = SlideObject.html && (SlideObject.innerSlideIndex + 1 < SlideObject.slideSize) ? currentSlide : currentSlide + 1; */ /* const nextSlideIdx = SlideObject.html && (SlideObject.innerSlideIndex + 1 < SlideObject.slideSize) ? currentSlide : currentSlide + 1; */
/* const nextSlide = SlideModel.getItem(nextSlideIdx); */ /* const nextSlide = SlideModel.getItem(nextSlideIdx); */
/* if (nextSlideIdx > totalSlides || nextSlideIdx < 0) */ /* if (nextSlideIdx > totalSlides || nextSlideIdx < 0) */

View file

@ -35,7 +35,7 @@ Item {
padding: 10 padding: 10
onEditingFinished: updateTitle(text); onEditingFinished: updateTitle(text);
background: Presenter.TextBackground { background: Presenter.TextBackground {
control: fontBox control: parent
} }
} }
@ -44,15 +44,15 @@ Item {
implicitWidth: 100 implicitWidth: 100
hoverEnabled: true hoverEnabled: true
background: Presenter.TextBackground { background: Presenter.TextBackground {
control: fontBox control: parent
} }
indicator: Kirigami.Icon { indicator: Kirigami.Icon {
anchors {right: parent.right anchors {right: parent.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
rightMargin: 2} rightMargin: 2}
source: "arrow-down" source: "arrow-down"
rotation: fontBox.down ? 180 : 0 rotation: parent.down ? 180 : 0
color: fontBox.pressed ? Kirigami.Theme.focusColor : Kirigami.Theme.textColor color: parent.pressed ? Kirigami.Theme.focusColor : Kirigami.Theme.textColor
Behavior on rotation { Behavior on rotation {
NumberAnimation { NumberAnimation {
@ -205,7 +205,7 @@ Item {
} }
function changePresentation(index) { function changePresentation(index) {
let pres = presProxyModel.presentationModel.getItem(index); let pres = presentationModel.getItem(index);
root.presentation = pres; root.presentation = pres;
console.log(pres.filePath.toString()); console.log(pres.filePath.toString());
updatePageCount(presentationPreview.frameCount); updatePageCount(presentationPreview.frameCount);
@ -215,7 +215,7 @@ Item {
function updateTitle(text) { function updateTitle(text) {
changeTitle(text, false); changeTitle(text, false);
presProxyModel.presentationModel.updateTitle(presentation.id, text); presentationModel.updateTitle(presentation.id, text);
showPassiveNotification(presentation.title); showPassiveNotification(presentation.title);
} }
@ -230,6 +230,6 @@ Item {
if (curPageCount === presentation.pageCount) if (curPageCount === presentation.pageCount)
return; return;
presentation.pageCount = pageCount; presentation.pageCount = pageCount;
presProxyModel.presentationModel.updatePageCount(presentation.id, pageCount); presentationModel.updatePageCount(presentation.id, pageCount);
} }
} }

View file

@ -67,10 +67,10 @@ Window {
target: SlideObject target: SlideObject
function onVideoBackgroundChanged() { function onVideoBackgroundChanged() {
if (SlideObject.videoBackground === "") if (SlideObject.videoBackground === "")
stopVideo(); presentationSlide.stopVideo();
else { else {
loadVideo(); presentationSlide.loadVideo();
playVideo(); presentationSlide.playVideo();
} }
} }
function onIsPlayingChanged() { function onIsPlayingChanged() {

View file

@ -73,7 +73,7 @@ Item {
id: video id: video
anchors.fill: parent anchors.fill: parent
muted: preview muted: preview
Component.onCompleted: mpvLoadingTimer.start() /* Component.onCompleted: mpvLoadingTimer.start() */
loops: itemType == "song" ? MediaPlayer.Infinite : vidLoop ? MediaPlayer.Infinite : 1 loops: itemType == "song" ? MediaPlayer.Infinite : vidLoop ? MediaPlayer.Infinite : 1
source: videoSource source: videoSource

View file

@ -75,7 +75,7 @@ Item {
text: "File" text: "File"
icon.name: "fileopen" icon.name: "fileopen"
hoverEnabled: true hoverEnabled: true
onClicked: fileType.open() onClicked: fileHelper.loadFile("Select video...", "video")
} }
} }
} }

View file

@ -257,6 +257,7 @@ use crate::presentation_model::{
self, Presentation, PresentationModelRust, self, Presentation, PresentationModelRust,
}; };
use crate::slide_model::slide_model::QList_QString; use crate::slide_model::slide_model::QList_QString;
use crate::slide_types::PresType;
use crate::songs::song_model::song_model::{self, SongModel}; use crate::songs::song_model::song_model::{self, SongModel};
use crate::songs::song_model::{Song, SongModelRust, get_song}; use crate::songs::song_model::{Song, SongModelRust, get_song};
use crate::video_model::video_model::VideoModel; use crate::video_model::video_model::VideoModel;
@ -402,6 +403,7 @@ impl Slide {
fn slide_from_video(video: Video) -> Result<Self> { fn slide_from_video(video: Video) -> Result<Self> {
Ok(Self { Ok(Self {
ty: SlideType::Video,
video_background: video.path, video_background: video.path,
video_start_time: video.start_time, video_start_time: video.start_time,
video_end_time: video.end_time, video_end_time: video.end_time,
@ -412,6 +414,7 @@ impl Slide {
fn slide_from_image(image: Image) -> Result<Self> { fn slide_from_image(image: Image) -> Result<Self> {
Ok(Self { Ok(Self {
ty: SlideType::Image,
image_background: image.path, image_background: image.path,
..Default::default() ..Default::default()
}) })
@ -424,6 +427,7 @@ impl Slide {
let mut slides: Vec<Slide> = vec![]; let mut slides: Vec<Slide> = vec![];
for i in 0..total { for i in 0..total {
slides.push(Self { slides.push(Self {
ty: SlideType::Presentation(PresType::Generic),
html: presentation.html, html: presentation.html,
slide_count: total, slide_count: total,
slide_index: i, slide_index: i,
@ -643,6 +647,7 @@ impl slide_model::SlideModel {
kind: &QString, kind: &QString,
) -> Result<()> { ) -> Result<()> {
let kind = SlideType::try_from(kind.clone())?; let kind = SlideType::try_from(kind.clone())?;
debug!(?kind);
match kind { match kind {
SlideType::Song => { SlideType::Song => {
let song = get_song(item_model_id)?; let song = get_song(item_model_id)?;