things are building and running now

Now for all the issues of things not working
This commit is contained in:
Chris Cochrun 2024-09-12 11:19:03 -05:00
parent f231b81bf4
commit a1f18f803d
8 changed files with 66 additions and 115 deletions

View file

@ -12,4 +12,7 @@ clean:
cargo clean cargo clean
rm -rf bld/ rm -rf bld/
test: test:
RUST_LOG=debug cargo test --benches --tests --all-features -- --nocapture RUST_LOG=debug cargo test --benches --tests --all-features -- --nocapture
alias b := build
alias r := run

View file

@ -73,37 +73,6 @@ static QWindow *windowFromEngine(QQmlApplicationEngine *engine)
return window; return window;
} }
// static void connectToDatabase() {
// // let's setup our sql database
// QSqlDatabase db = QSqlDatabase::database();
// if (!db.isValid()){
// db = QSqlDatabase::addDatabase("QSQLITE");
// if (!db.isValid())
// qFatal("Cannot add database: %s", qPrintable(db.lastError().text()));
// }
// const QDir writeDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
// qDebug() << "dir location " << writeDir.absolutePath();
// if (!writeDir.mkpath(".")) {
// qFatal("Failed to create writable location at %s", qPrintable(writeDir.absolutePath()));
// }
// const QString dbName = writeDir.absolutePath() + "/library-db.sqlite3";
// db.setHostName("localhost");
// db.setDatabaseName(dbName);
// db.setUserName("presenter");
// // TODO change password system before launch
// db.setPassword("i393jkf782djyr98302j");
// if (!db.open()) {
// qFatal("Cannot open database: %s", qPrintable(db.lastError().text()));
// QFile::remove(dbName);
// }
// qDebug() << "Finished connecting to db";
// }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// qDebug() << QSurfaceFormat::defaultFormat(); // qDebug() << QSurfaceFormat::defaultFormat();
@ -224,6 +193,8 @@ int main(int argc, char *argv[])
// qmlRegisterType<MpvItem>("mpv", 1, 0, "MpvItem"); // qmlRegisterType<MpvItem>("mpv", 1, 0, "MpvItem");
// qmlRegisterSingletonInstance("org.presenter", 1, 0, "MpvProperties", MpvProperties::self()); // qmlRegisterSingletonInstance("org.presenter", 1, 0, "MpvProperties", MpvProperties::self());
qDebug() << serviceItemModel.count;
//register our models //register our models
// qmlRegisterType<SongProxyModel>("org.presenter", 1, 0, "SongProxyModel"); // qmlRegisterType<SongProxyModel>("org.presenter", 1, 0, "SongProxyModel");
// qmlRegisterType<VideoProxyModel>("org.presenter", 1, 0, "VideoProxyModel"); // qmlRegisterType<VideoProxyModel>("org.presenter", 1, 0, "VideoProxyModel");

View file

@ -203,7 +203,7 @@ Kirigami.ApplicationWindow {
folder: shortcuts.home folder: shortcuts.home
/* fileMode: Labs.FileDialog.SaveFile */ /* fileMode: Labs.FileDialog.SaveFile */
defaultSuffix: ".pres" defaultSuffix: ".pres"
selectExisting: false /* selectExisting: false */
onAccepted: { onAccepted: {
ServiceItemModel.save(saveFileDialog.fileUrl); ServiceItemModel.save(saveFileDialog.fileUrl);
console.log(saveFileDialog.fileUrl); console.log(saveFileDialog.fileUrl);
@ -223,7 +223,7 @@ Kirigami.ApplicationWindow {
folder: shortcuts.home folder: shortcuts.home
/* fileMode: Labs.FileDialog.SaveFile */ /* fileMode: Labs.FileDialog.SaveFile */
defaultSuffix: ".pres" defaultSuffix: ".pres"
selectExisting: true /* selectExisting: true */
onAccepted: { onAccepted: {
load(loadFileDialog.fileUrl); load(loadFileDialog.fileUrl);
} }
@ -237,7 +237,7 @@ Kirigami.ApplicationWindow {
title: "Pick a Sound Effect" title: "Pick a Sound Effect"
folder: shortcuts.home folder: shortcuts.home
/* fileMode: Labs.FileDialog.SaveFile */ /* fileMode: Labs.FileDialog.SaveFile */
selectExisting: true /* selectExisting: true */
onAccepted: { onAccepted: {
soundEffect = loadFileDialog.fileUrl; soundEffect = loadFileDialog.fileUrl;
showPassiveNotification(soundEffect); showPassiveNotification(soundEffect);

View file

@ -222,7 +222,7 @@ ColumnLayout {
Item { Item {
implicitWidth: ListView.view.width implicitWidth: ListView.view.width
height: selectedLibrary == libraryType ? 50 : 0 height: selectedLibrary == libraryType ? 50 : 0
Kirigami.BasicListItem { Controls.ItemDelegate {
id: listItem id: listItem
property bool rightMenu: false property bool rightMenu: false
@ -236,43 +236,48 @@ ColumnLayout {
implicitWidth: libraryList.width implicitWidth: libraryList.width
height: selectedLibrary == libraryType ? 50 : 0 height: selectedLibrary == libraryType ? 50 : 0
clip: true text: title
label: title
subtitle: { /* subtitle: { */
if (libraryType == "song") /* if (libraryType == "song") */
author /* author */
else if (fileValidation) /* else if (fileValidation) */
filePath; /* filePath; */
else /* else */
"file is missing" /* "file is missing" */
} /* } */
icon: itemIcon
iconSize: Kirigami.Units.gridUnit
supportsMouseEvents: false
backgroundColor: index % 2 === 0 ? Kirigami.Theme.backgroundColor : Kirigami.Theme.alternateBackgroundColor;
Binding on backgroundColor {
when: dragHandler.containsMouse ||
(selectionModel.hasSelection &&
selectionModel.isSelected(proxyModel.idx(index)))
value: Kirigami.Theme.highlightColor
}
textColor: { icon.source: itemIcon
if (selectedLibrary == "song") icon.width: Kirigami.Units.gridUnit
Kirigami.Theme.textColor; icon.height: Kirigami.Units.gridUnit
else if (fileValidation) { /* supportsMouseEvents: false */
Kirigami.Theme.textColor; /* background: Rectangle { */
} /* color: Kirigami.Theme.backgroundColor */
else /* fill: parent */
"red" /* } */
} /* Binding on backgroundColor { */
/* when: dragHandler.containsMouse || */
/* (selectionModel.hasSelection && */
/* selectionModel.isSelected(proxyModel.idx(index))) */
/* value: Kirigami.Theme.highlightColor */
/* } */
Binding on textColor { /* textColor: { */
when: dragHandler.containsMouse || /* if (selectedLibrary == "song") */
(selectionModel.hasSelection && /* Kirigami.Theme.textColor; */
selectionModel.isSelected(proxyModel.idx(index))) /* else if (fileValidation) { */
value: Kirigami.Theme.highlightedTextColor /* Kirigami.Theme.textColor; */
} /* } */
/* else */
/* "red" */
/* } */
/* Binding on textColor { */
/* when: dragHandler.containsMouse || */
/* (selectionModel.hasSelection && */
/* selectionModel.isSelected(proxyModel.idx(index))) */
/* value: Kirigami.Theme.highlightedTextColor */
/* } */
Behavior on height { Behavior on height {
NumberAnimation { NumberAnimation {

View file

@ -14,7 +14,7 @@ Controls.Page {
// properties passed around for the slides // properties passed around for the slides
property int currentServiceItem property int currentServiceItem
property int currentSlide property int currentSlide
property int totalServiceItems: ServiceItemModel.rowCount property int totalServiceItems: ServiceItemModel.rowCount()
property int totalSlides: SlideModel.count property int totalSlides: SlideModel.count
property url imageBackground: presentation.imageBackground property url imageBackground: presentation.imageBackground
property url videoBackground: presentation.vidBackground property url videoBackground: presentation.vidBackground
@ -155,10 +155,10 @@ Controls.Page {
anchors.left: parent.right anchors.left: parent.right
url: "file:///home/chris/org/lessons/2023_24_3_noah_lesson.html" url: "file:///home/chris/org/lessons/2023_24_3_noah_lesson.html"
visible: false visible: false
WebEngineScript { /* WebEngineScript { */
name: "html2canvas" /* name: "html2canvas" */
sourceUrl: "file:///home/chris/dev/lumina/src/qml/presenter/html2canvas.min.js" /* sourceUrl: "file:///home/chris/dev/lumina/src/qml/presenter/html2canvas.min.js" */
} /* } */
onLoadingChanged: { onLoadingChanged: {
if (loadRequest.status == 2) if (loadRequest.status == 2)
showPassiveNotification("yahoo?"); showPassiveNotification("yahoo?");

View file

@ -1,7 +1,7 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15 import Qt5Compat.GraphicalEffects
import org.kde.kirigami 2.13 as Kirigami import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter import "./" as Presenter
import org.presenter 1.0 import org.presenter 1.0
@ -42,7 +42,7 @@ Kirigami.OverlaySheet {
text: videoInput.text.startsWith("http") ? "Download" : "Local Video" text: videoInput.text.startsWith("http") ? "Download" : "Local Video"
icon.name: "folder-videos-symbolic" icon.name: "folder-videos-symbolic"
hoverEnabled: true hoverEnabled: true
onClicked: videoInput.text.startsWith("http") ? loadVideo() : videoFileDialog.open() onClicked: videoInput.text.startsWith("http") ? loadVideo() : addVideo(fileHelper.load("Pick a video", "video"));
} }
} }
} }
@ -134,23 +134,6 @@ Kirigami.OverlaySheet {
} }
FileDialog {
id: videoFileDialog
title: "Please choose a video"
folder: shortcuts.home
selectMultiple: false
nameFilters: ["Video files (*.mp4 *.mkv *.mov *.wmv *.avi *.MP4 *.MOV *.MKV)"]
onAccepted: {
console.log("video = " + videoFileDialog.fileUrls[0]);
addVideo(videoFileDialog.fileUrls[0]);
root.close();
}
onRejected: {
console.log("Canceled")
}
}
Timer { Timer {
id: videoDLTimer id: videoDLTimer
interval: 3000 interval: 3000

View file

@ -81,6 +81,7 @@ Item {
id: serviceListItem id: serviceListItem
implicitWidth: serviceItemList.width implicitWidth: serviceItemList.width
height: Kirigami.Units.gridUnit * 2 height: Kirigami.Units.gridUnit * 2
Component.onCompleted: Utils.dbg("SERVICEMODEL: " + name)
property var selectedItems property var selectedItems
@ -150,6 +151,7 @@ Item {
else else
Kirigami.Theme.textColor; Kirigami.Theme.textColor;
} }
Component.onCompleted: Utils.dbg("SERVICEMODEL: " + name)
} }
Kirigami.Icon { Kirigami.Icon {
@ -359,6 +361,7 @@ Item {
model: ServiceItemModel model: ServiceItemModel
delegate: serviceListItem delegate: serviceListItem
Kirigami.WheelHandler { Kirigami.WheelHandler {
id: wheelHandler id: wheelHandler
target: serviceItemList target: serviceItemList
@ -375,22 +378,6 @@ Item {
anchors.bottom: serviceItemList.bottom anchors.bottom: serviceItemList.bottom
active: hovered || pressed active: hovered || pressed
} }
/* function updateDrag(y) { */
/* if (moveToIndex === serviceItemList.indexAt(0,y)) */
/* return; */
/* else */
/* moveToIndex = serviceItemList.indexAt(0,y); */
/* moveRequested(indexDragged, moveToIndex); */
/* } */
/* function moveRequested(oldIndex, newIndex) { */
/* console.log("moveRequested: ", oldIndex, newIndex); */
/* ServiceItemModel.moveRows(oldIndex, newIndex, 1); */
/* indexDragged = newIndex; */
/* serviceItemList.currentIndex = newIndex; */
/* } */
} }
Rectangle { Rectangle {

View file

@ -479,7 +479,7 @@ impl service_item_model::ServiceItemModel {
) { ) {
let index = self.as_ref().service_items.len() as i32; let index = self.as_ref().service_items.len() as i32;
println!("{:?}", service_item); println!("{:?}", service_item);
let service_item = service_item.clone(); let s_item = service_item.clone();
let count = self.as_ref().count; let count = self.as_ref().count;
self.as_mut().set_count(count + 1); self.as_mut().set_count(count + 1);
unsafe { unsafe {
@ -488,10 +488,11 @@ impl service_item_model::ServiceItemModel {
index, index,
index, index,
); );
self.as_mut().rust_mut().service_items.push(service_item); self.as_mut().rust_mut().service_items.push(s_item);
self.as_mut().end_insert_rows(); self.as_mut().end_insert_rows();
} }
let item = self.as_mut().get_item(index); let item = self.as_mut().get_item(index);
debug!("ADDING: {:?}", &service_item);
self.as_mut().item_added(&index, &item); self.as_mut().item_added(&index, &item);
} }
@ -537,7 +538,7 @@ impl service_item_model::ServiceItemModel {
service_item: &ServiceItem, service_item: &ServiceItem,
id: i32, id: i32,
) { ) {
let service_item = service_item.clone(); let s_item = service_item.clone();
unsafe { unsafe {
self.as_mut().begin_insert_rows( self.as_mut().begin_insert_rows(
&QModelIndex::default(), &QModelIndex::default(),
@ -547,10 +548,11 @@ impl service_item_model::ServiceItemModel {
self.as_mut() self.as_mut()
.rust_mut() .rust_mut()
.service_items .service_items
.insert(id as usize, service_item); .insert(id as usize, s_item);
self.as_mut().end_insert_rows(); self.as_mut().end_insert_rows();
} }
let item = self.as_mut().get_item(id); let item = self.as_mut().get_item(id);
debug!("ADDING: {:?}", &service_item);
self.as_mut().item_inserted(&id, &item); self.as_mut().item_inserted(&id, &item);
} }