From 7e6e8c71e022e891c613e8441906a479ab0dcbdf Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 28 Sep 2023 15:17:35 -0500 Subject: [PATCH] small changes and the beginning of a TextBackground.qml --- src/qml/presenter/SongEditor.qml | 9 +++++---- src/qml/presenter/TextBackground.qml | 20 ++++++++++++++++++++ src/qml/presenter/qmldir | 2 +- src/rust/songs/song_model.rs | 6 +++++- 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 src/qml/presenter/TextBackground.qml diff --git a/src/qml/presenter/SongEditor.qml b/src/qml/presenter/SongEditor.qml index a6e1b32..268f10b 100644 --- a/src/qml/presenter/SongEditor.qml +++ b/src/qml/presenter/SongEditor.qml @@ -120,7 +120,7 @@ Item { Layout.fillHeight: true text: "Image" icon.name: "folder-pictures-symbolic" - onClicked: imageFileDialog.open() & backgroundTypePopup.close() + onClicked: updateBackground("image") & backgroundTypePopup.close() } } } @@ -499,10 +499,11 @@ Item { songProxyModel.songModel.updateAudio(songIndex, file); } - function updateBackground(background, backgroundType) { + function updateBackground(backgroundType) { song.backgroundType = backgroundType; - song.background = background; - songProxyModel.songModel.updateBackground(songIndex, background); + const file = fileHelper.loadFile("Pick Background"); + song.background = file; + songProxyModel.songModel.updateBackground(songIndex, file); songProxyModel.songModel.updateBackgroundType(songIndex, backgroundType); console.log("changed background"); /* if (backgroundType === "image") { */ diff --git a/src/qml/presenter/TextBackground.qml b/src/qml/presenter/TextBackground.qml new file mode 100644 index 0000000..0ba3fcd --- /dev/null +++ b/src/qml/presenter/TextBackground.qml @@ -0,0 +1,20 @@ +import QtQuick 2.13 + +Rectangle { + // Used for + property var control + property bool errorCondition + + color: Kirigami.Theme.backgroundColor + implicitWidth: parent.width + implicitHeight: parent.height + radius: 10 + border.color: { + if (control.enabled) + return Kirigami.Theme.highlightColor + else if (errorCondition) + return Kirigami.Theme.negativeTextColor + else + return Kirigami.Theme.positiveColor + } +} diff --git a/src/qml/presenter/qmldir b/src/qml/presenter/qmldir index d45d1b4..4fc0336 100644 --- a/src/qml/presenter/qmldir +++ b/src/qml/presenter/qmldir @@ -1,3 +1,3 @@ module presenter MainWindow 1.0 MainWindow.qml -LeftDock 1.0 LeftDock.qml +LeftDock 1.0 LeftDock.qml \ No newline at end of file diff --git a/src/rust/songs/song_model.rs b/src/rust/songs/song_model.rs index ac6fadb..a118c37 100644 --- a/src/rust/songs/song_model.rs +++ b/src/rust/songs/song_model.rs @@ -535,7 +535,11 @@ pub mod song_model { { song.background = updated_background.to_string(); - println!("change: updated_background: {:?} model_index: {:?} roles: {:?}", updated_background, model_index, vector_roles.get(0)); + debug!( + background = updated_background, + model_index = model_index, + roles = vector_roles.get(0) + ); self.as_mut().emit_data_changed( model_index, model_index,