This commit is contained in:
Chris Cochrun 2025-07-25 15:19:21 -05:00
parent 92f2b18a20
commit 504b4bc944
24 changed files with 289 additions and 175 deletions

View file

@ -1,31 +1,31 @@
#include <QApplication>
#include <QQmlApplicationEngine>
// #include <QApplication>
#include <QtQml/QQmlApplicationEngine>
#include <QtCore/qstringliteral.h>
#include <QtQml>
#include <QUrl>
#include <QDebug>
#include <KLocalizedContext>
#include <KLocalizedString>
#include <KAboutData>
#include <QtQml/QtQml>
#include <QtCore/QUrl>
#include <QtCore/QDebug>
// #include <K/KLocalizedContext>
// #include <KLocalizedString>
// #include <KAboutData>
#include <iostream>
#include <QQmlEngine>
#include <QtWebEngineQuick>
#include <QObject>
#include <QtGlobal>
#include <QOpenGLContext>
#include <QGuiApplication>
#include <QQuickStyle>
#include <QSurfaceFormat>
#include <QtQml/QQmlEngine>
#include <QtWebEngineQuick/QtWebEngineQuick>
#include <QtCore/QObject>
#include <QtCore/QtGlobal>
#include <QtGui/QOpenGLContext>
#include <QtGui/QGuiApplication>
#include <QtQuickControls2/QQuickStyle>
// #include <QSurfaceFormat>
#include <QtQuick/QQuickWindow>
#include <QtQuick/QQuickView>
#include <qapplication.h>
#include <qcoreapplication.h>
#include <qdir.h>
#include <qglobal.h>
#include <qguiapplication.h>
#include <qqml.h>
#include <qquickstyle.h>
#include <qstringliteral.h>
// #include <qapplication.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdir.h>
#include <QtCore/qglobal.h>
#include <QtGui/qguiapplication.h>
#include <QtQml/qqml.h>
#include <QtQuickControls2/qquickstyle.h>
#include <QtCore/qstringliteral.h>
// #include <MpvAbstractItem>
// #include "cpp/mpv/mpvitem.h"
// #include "cpp/mpv/mpvproperties.h"
@ -60,22 +60,22 @@ int main(int argc, char *argv[])
QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("video-display")));
QtWebEngineQuick::initialize();
QGuiApplication app(argc, argv);
KLocalizedString::setApplicationDomain("lumina");
KAboutData about;
about.setComponentName(QStringLiteral("lumina"));
about.setDisplayName(i18n("lumina"));
about.setVersion(QByteArray("0.1"));
about.setShortDescription(i18n("A churchpresentation app build with KDE tech."));
about.setLicense(KAboutLicense::GPL_V3);
// KLocalizedString::setApplicationDomain("lumina");
// KAboutData about;
// about.setComponentName(QStringLiteral("lumina"));
// about.setDisplayName(i18n("lumina"));
// about.setVersion(QByteArray("0.1"));
// about.setShortDescription(i18n("A churchpresentation app build with KDE tech."));
// about.setLicense(KAboutLicense::GPL_V3);
// overwrite default-generated values of organizationDomain & desktopFileName
about.setOrganizationDomain("tfcconnection.org");
about.setDesktopFileName(QStringLiteral("org.tfcconneciton.lumina"));
// about.setOrganizationDomain("tfcconnection.org");
// about.setDesktopFileName(QStringLiteral("org.tfcconneciton.lumina"));
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
// set the application metadata
KAboutData::setApplicationData(about);
// KAboutData::setApplicationData(about);
QCoreApplication::setOrganizationName(QStringLiteral("lumina"));
QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org"));
QCoreApplication::setApplicationName(QStringLiteral("lumina"));
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
// qDebug() << QQuickStyle::availableStyles();
qDebug() << QIcon::themeName();
qDebug() << QApplication::platformName();
// qDebug() << QApplication::platformName();
//Need to instantiate our slide
QScopedPointer<SlideModel> slideModel(new SlideModel);
@ -108,6 +108,7 @@ int main(int argc, char *argv[])
settings->setup();
QQuickView *PresWindow = new QQuickView;
PresWindow->setSource(QUrl(QStringLiteral("qrc:qml/presenter/PresentationWindow.qml")));
qDebug() << PresWindow;
qDebug() << PresWindow->isVisible();
@ -169,9 +170,9 @@ int main(int argc, char *argv[])
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideModel", slideModel.get());
qmlRegisterSingletonInstance("org.presenter", 1, 0, "Utils", utils);
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slideobject.get());
qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", PresWindow);
qmlRegisterSingletonInstance("org.presenter", 1, 0, "RSettings", settings);
qmlRegisterSingletonInstance("org.presenter", 1, 0, "ObsModel", obsModel.get());
qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", PresWindow);
// This is the same slideobject, however to enusre that the PresWindow can have it
// we need to set it as a separate context so that it can change it's slides too.
@ -184,7 +185,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
qDebug() << app.allWindows();
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
// engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.load(QUrl(QStringLiteral("qrc:qml/main.qml")));
qDebug() << "Engine loaded";

View file

@ -252,6 +252,7 @@ Item {
}
function isDragFile(item) {
console.log(item);
console.log(item.toString());
var extension = item.toString().split('.').pop();
var valid = false;

View file

@ -188,6 +188,10 @@ Controls.Page {
songModel: songModel
}
Presenter.PresentationWindow {
id: presWindow
}
Connections {
target: ServiceItemModel
function onSaveProgressChanged() {
@ -352,19 +356,20 @@ Controls.Page {
function present(present) {
if (present)
{
PresWindow.showFullScreen();
PresWindow.setSource("qrc:qml/presenter/PresentationWindow.qml")
console.log(PresWindow);
/* presWindow.slideObj = SlideObject; */
presWindow.showFullScreen();
/* presWindow.setSource("qrc:qml/presenter/PresentationWindow.qml") */
console.log(presWindow);
/* presWinLoader.active = true; */
}
else {
PresWindow.close();
presWindow.close();
/* presWinLoader.active = false; */
}
}
function closeAll() { PresWindow.close() }
function closeAll() { presWindow.close() }
function changeVidPos(pos) {
presentation.slide.seek(pos);

View file

@ -479,6 +479,11 @@ FocusScope {
previewSlide.stopVideo()
}
function playVideo() {
/* showPassiveNotification("Stopping Video") */
previewSlide.playVideo()
}
function nextSlideAction() {
keyHandler.forceActiveFocus();
SlideModel.next()

View file

@ -6,13 +6,13 @@ import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter
import org.presenter 1.0
Item {
Window {
id: presentationWindow
property Item slide: presentationSlide
/* property var slideObj */
/* property var SlideObject: SlideObject; */
property var pWin
anchors.fill: parent
/* anchors.fill: parent */
/* title: "presentation-window" */
/* height: maximumHeight */
@ -25,7 +25,7 @@ Item {
/* onClosing: { */
/* presentationSlide.stopVideo(); */
/* SlideObj.pause(); */
/* SlideObject.pause(); */
/* presentationSlide.stopAudio(); */
/* presenting = false; */
/* } */
@ -34,7 +34,7 @@ Item {
target: PresWindow
function onClosing() {
presentationSlide.stopVideo();
SlideObj.pause();
SlideObject.pause();
presentationSlide.stopAudio();
presenting = false;
}
@ -48,25 +48,25 @@ Item {
Presenter.Slide {
id: presentationSlide
anchors.fill: parent
imageSource: SlideObj.html ? "" : SlideObj.imageBackground
webSource: SlideObj.html ? SlideObj.imageBackground : ""
htmlVisible: SlideObj.html
videoSource: presentationWindow.visible ? SlideObj.videoBackground : ""
audioSource: SlideObj.audio
text: SlideObj.text
chosenFont: SlideObj.font
textSize: SlideObj.fontSize
pdfIndex: SlideObj.slideIndex
itemType: SlideObj.ty
vidLoop: SlideObj.looping
vidStartTime: SlideObj.videoStartTime
vidEndTime: SlideObj.videoEndTime
imageSource: SlideObject.html ? "" : SlideObject.imageBackground
webSource: SlideObject.html ? SlideObject.imageBackground : ""
htmlVisible: SlideObject.html
videoSource: presentationWindow.visible ? SlideObject.videoBackground : ""
audioSource: SlideObject.audio
text: SlideObject.text
chosenFont: SlideObject.font
textSize: SlideObject.fontSize
pdfIndex: SlideObject.slideIndex
itemType: SlideObject.ty
vidLoop: SlideObject.looping
vidStartTime: SlideObject.videoStartTime
vidEndTime: SlideObject.videoEndTime
}
Connections {
target: SlideObj
target: SlideObject
function onVideoBackgroundChanged() {
if (SlideObj.videoBackground === "")
if (SlideObject.videoBackground === "")
stopVideo();
else {
loadVideo();
@ -74,12 +74,12 @@ Item {
}
}
function onIsPlayingChanged() {
if(SlideObj.isPlaying)
if(SlideObject.isPlaying)
presentationSlide.playVideo();
pauseVideo();
}
function onLoopingChanged() {
if(SlideObj.looping)
if(SlideObject.looping)
presentationSlide.loopVideo();
}
function onAudioChanged() {

View file

@ -21,6 +21,7 @@ Kirigami.OverlaySheet {
Kirigami.FormLayout {
implicitHeight: Kirigami.Units.gridUnit * 30
implicitWidth: Kirigami.Units.gridUnit * 30
Controls.ComboBox {
id: screenSelectionField
Kirigami.FormData.label: i18nc("@label:textbox", "Presentation Screen:")

View file

@ -10,6 +10,9 @@ mod file_helper {
// include!("cxx-qt-lib/qvariant.h");
// type QVariant = cxx_qt_lib::QVariant;
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[qml_element]
@ -96,7 +99,9 @@ impl file_helper::FileHelper {
QUrl::from(string.as_str())
}
} else {
error!("There was an error, is xdg-desktop-portals correctly setup?");
error!(
"There was an error, is xdg-desktop-portals correctly setup?"
);
QUrl::default()
}
}
@ -145,7 +150,9 @@ impl file_helper::FileHelper {
QUrl::from(string.as_str())
}
} else {
error!("Couldn't load file, is xdg-desktop-portals correctly setup?");
error!(
"Couldn't load file, is xdg-desktop-portals correctly setup?"
);
QUrl::default()
}
}

View file

@ -32,6 +32,8 @@ pub mod image_model {
Title,
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[base = QAbstractListModel]
@ -83,6 +85,8 @@ pub mod image_model {
impl cxx_qt::Threading for ImageModel {}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]

View file

@ -1,8 +1,8 @@
use core::fmt;
use cxx_qt::CxxQtType;
use cxx_qt_lib::{QString, QStringList};
use obws::responses::scenes::{CurrentProgramScene, Scenes};
use obws::Client;
use obws::responses::scenes::{CurrentProgramScene, Scenes};
use std::{error::Error, pin::Pin};
use tracing::{debug, error};
@ -127,6 +127,8 @@ mod obs {
type QList_QString = cxx_qt_lib::QList<QString>;
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[qml_element]

View file

@ -34,6 +34,8 @@ pub mod presentation_model {
PageCount,
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[base = QAbstractListModel]
@ -101,6 +103,8 @@ pub mod presentation_model {
impl cxx_qt::Threading for PresentationModel {}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]

View file

@ -44,6 +44,8 @@ mod service_item_model {
Id,
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[base = QAbstractListModel]
@ -193,6 +195,8 @@ mod service_item_model {
impl cxx_qt::Threading for ServiceItemModel {}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]

View file

@ -7,6 +7,8 @@ mod settings {
type QUrl = cxx_qt_lib::QUrl;
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[qml_element]

View file

@ -19,16 +19,16 @@ pub mod slide_model {
type QVector_i32 = cxx_qt_lib::QVector<i32>;
include!("cxx-qt-lib/qlist.h");
type QList_QString = cxx_qt_lib::QList<QString>;
include!("src/rust/slide_object.cxxqt.h");
include!("liblumina/src/rust/slide_object.cxxqt.h");
type SlideObject = crate::slide_object::qobject::SlideObject;
include!("src/rust/songs/song_model.cxxqt.h");
include!("liblumina/src/rust/songs/song_model.cxxqt.h");
type SongModel =
crate::songs::song_model::song_model::SongModel;
include!("src/rust/video_model.cxxqt.h");
include!("liblumina/src/rust/video_model.cxxqt.h");
type VideoModel = crate::video_model::video_model::VideoModel;
include!("src/rust/image_model.cxxqt.h");
include!("liblumina/src/rust/image_model.cxxqt.h");
type ImageModel = crate::image_model::image_model::ImageModel;
include!("src/rust/presentation_model.cxxqt.h");
include!("liblumina/src/rust/presentation_model.cxxqt.h");
type PresentationModel = crate::presentation_model::presentation_model::PresentationModel;
}
@ -60,6 +60,8 @@ pub mod slide_model {
ObsScene,
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[base = QAbstractListModel]
@ -158,6 +160,8 @@ pub mod slide_model {
impl cxx_qt::Threading for SlideModel {}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]

View file

@ -10,6 +10,8 @@ pub mod qobject {
// type SlideModel = crate::slide_model::slide_model::SlideModel;
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[qml_element]

View file

@ -15,11 +15,13 @@ pub mod song_editor {
include!("cxx-qt-lib/qlist.h");
type QList_QString = cxx_qt_lib::QList<QString>;
include!("src/rust/songs/song_model.cxxqt.h");
include!("liblumina/src/rust/songs/song_model.cxxqt.h");
type SongModel =
crate::songs::song_model::song_model::SongModel;
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[qml_element]

View file

@ -40,6 +40,8 @@ pub mod song_model {
FontSize,
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[base = QAbstractListModel]
@ -168,6 +170,8 @@ pub mod song_model {
impl cxx_qt::Threading for SongModel {}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]

View file

@ -35,6 +35,8 @@ pub mod video_model {
Looping,
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[base = QAbstractListModel]
@ -104,6 +106,8 @@ pub mod video_model {
impl cxx_qt::Threading for VideoModel {}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[inherit]
#[cxx_name = "beginInsertRows"]

View file

@ -7,6 +7,8 @@ mod ytdl {
type QString = cxx_qt_lib::QString;
}
#[auto_cxx_name]
#[auto_rust_name]
unsafe extern "RustQt" {
#[qobject]
#[qml_element]