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

View file

@ -388,7 +388,7 @@ FocusScope {
id: keyHandler
/* anchors.fill: parent */
focus: true
Keys.onPressed: {
Keys.onPressed: (event) => {
if (event.key == Qt.Key_J)
nextSlideAction();
if (event.key == Qt.Key_L)
@ -486,7 +486,8 @@ FocusScope {
function nextSlideAction() {
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 nextSlide = SlideModel.getItem(nextSlideIdx); */
/* if (nextSlideIdx > totalSlides || nextSlideIdx < 0) */

View file

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

View file

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

View file

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

View file

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

View file

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