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

@ -13,3 +13,6 @@ clean:
rm -rf bld/
test:
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;
}
// 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[])
{
// qDebug() << QSurfaceFormat::defaultFormat();
@ -224,6 +193,8 @@ int main(int argc, char *argv[])
// qmlRegisterType<MpvItem>("mpv", 1, 0, "MpvItem");
// qmlRegisterSingletonInstance("org.presenter", 1, 0, "MpvProperties", MpvProperties::self());
qDebug() << serviceItemModel.count;
//register our models
// qmlRegisterType<SongProxyModel>("org.presenter", 1, 0, "SongProxyModel");
// qmlRegisterType<VideoProxyModel>("org.presenter", 1, 0, "VideoProxyModel");

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
import QtQuick 2.15
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15
import Qt5Compat.GraphicalEffects
import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter
import org.presenter 1.0
@ -42,7 +42,7 @@ Kirigami.OverlaySheet {
text: videoInput.text.startsWith("http") ? "Download" : "Local Video"
icon.name: "folder-videos-symbolic"
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 {
id: videoDLTimer
interval: 3000

View file

@ -81,6 +81,7 @@ Item {
id: serviceListItem
implicitWidth: serviceItemList.width
height: Kirigami.Units.gridUnit * 2
Component.onCompleted: Utils.dbg("SERVICEMODEL: " + name)
property var selectedItems
@ -150,6 +151,7 @@ Item {
else
Kirigami.Theme.textColor;
}
Component.onCompleted: Utils.dbg("SERVICEMODEL: " + name)
}
Kirigami.Icon {
@ -359,6 +361,7 @@ Item {
model: ServiceItemModel
delegate: serviceListItem
Kirigami.WheelHandler {
id: wheelHandler
target: serviceItemList
@ -375,22 +378,6 @@ Item {
anchors.bottom: serviceItemList.bottom
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 {

View file

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