Screens work and the beginnings of a settings module

This commit is contained in:
Chris Cochrun 2022-03-11 17:00:19 -06:00
parent 9882a0a289
commit fab9f86b41
6 changed files with 67 additions and 32 deletions

View file

@ -16,6 +16,7 @@
#include <QtGlobal>
#include <QOpenGLContext>
#include <QGuiApplication>
#include <QQuickStyle>
#include <QtGui/QOpenGLFramebufferObject>
@ -23,9 +24,11 @@
#include <QtQuick/QQuickView>
#include <qdir.h>
#include <qglobal.h>
#include <qguiapplication.h>
#include <qqml.h>
#include <qsqldatabase.h>
#include <qsqlquery.h>
#include <qstringliteral.h>
#include "songlistmodel.h"
#include "mpv/mpvobject.h"
@ -62,12 +65,20 @@ static void connectToDatabase() {
int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
QGuiApplication app(argc, argv);
KLocalizedString::setApplicationDomain("presenter");
QCoreApplication::setOrganizationName(QStringLiteral("presenter"));
QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org"));
QCoreApplication::setApplicationName(QStringLiteral("Church Presenter"));
#ifdef Q_OS_WINDOWS
QIcon::setFallbackThemeName("breeze");
QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
#else
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
#endif
QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("system-config-display")));
// apparently mpv needs this class set
std::setlocale(LC_NUMERIC, "C");
qmlRegisterType<MpvObject>("mpv", 1, 0, "MpvObject");

View file

@ -88,6 +88,11 @@ Kirigami.ApplicationWindow {
libraryOpen = !libraryOpen
}
function togglePresenting() {
presenting = !presenting
mainPage.present(presenting);
}
function openSettings() {
settingsSheet.open()
}
@ -96,12 +101,15 @@ Kirigami.ApplicationWindow {
/* showPassiveNotification(Kirigami.Settings.style); */
/* Kirigami.Settings.style = "Plasma"; */
/* showPassiveNotification(Kirigami.Settings.style); */
print(Qt.platform.os);
print("checking screens");
print("OS is: " + Qt.platform.os);
/* print("checking screens"); */
print("Present Mode is " + presenting);
/* print(Qt.application.state); */
screens = Qt.application.screens;
presentationScreen = screens[1]
for (let i = 0; i < screens.length; i++) {
print(screens[i].name);
/* print(screens[i]); */
/* print(screens[i].name); */
screenModel.append({
"name": screens[i].name,
"width": (screens[i].width * screens[i].devicePixelRatio),
@ -109,19 +117,23 @@ Kirigami.ApplicationWindow {
"pixeldensity": screens[i].pixelDensity,
"pixelratio": screens[i].devicePixelRatio
})
print("width of screen: " + (screens[i].width * screens[i].devicePixelRatio));
print("height of screen: " + (screens[i].height * screens[i].devicePixelRatio));
print("pixeldensity of screen: " + screens[i].pixelDensity);
print("pixelratio of screen: " + screens[i].devicePixelRatio);
/* print("width of screen: " + (screens[i].width * screens[i].devicePixelRatio)); */
/* print("height of screen: " + (screens[i].height * screens[i].devicePixelRatio)); */
/* print("pixeldensity of screen: " + screens[i].pixelDensity); */
/* print("pixelratio of screen: " + screens[i].devicePixelRatio); */
if (i == 0)
print("Current Screens available: ");
print(screenModel.get(i).name);
}
}
Presenter.Settings {
id: settingsSheet
model: screenModel
}
ListModel {
id: screenModel
}
Presenter.Settings {
id: settingsSheet
theModel: screenModel
}
}

View file

@ -39,8 +39,8 @@ Kirigami.ActionToolBar {
icon.name: "view-presentation"
text: presenting ? "Presenting" : "Go Live"
onTriggered: {
print("Window is loading")
presenting = true
print("Window is loading");
togglePresenting();
}
},

View file

@ -161,8 +161,11 @@ ColumnLayout {
background: "file:/home/chris/nextcloud/tfc/openlp/videos/test.mp4"
}
ListElement {
name: "Marvelous Light"
type: "song"
name: "facebook"
type: "video"
text: ""
backgroundType: "video"
background: "file:/home/chris/nextcloud/tfc/videos/facebook-ukraine-vid.mkv"
}
ListElement {
name: "10,000 Reason"

View file

@ -28,12 +28,6 @@ Controls.Page {
property var song
property var draggedLibraryItem
signal songLyricsUpdated(string lyrics)
Component.onCompleted: {
mainPage.songLyricsUpdated.connect(library.updateSongLyrics);
}
Item {
id: mainItem
anchors.fill: parent
@ -97,12 +91,13 @@ Controls.Page {
title: "presentation-window"
height: maximumHeight
width: maximumWidth
screen: screens[0]
screen: presentationScreen
flags: Qt.X11BypassWindowManagerHint
onClosing: presenting = false
Component.onCompleted: {
presentationWindow.showFullScreen();
print(screens[1].name)
print(screen.name);
}
Presenter.Slide {
@ -110,14 +105,14 @@ Controls.Page {
anchors.fill: parent
imageSource: imageBackground
videoSource: videoBackground
text: "good"
text: ""
Component.onCompleted: slideItem = presentationSlide
}
}
}
FileDialog {
id: videoFileDialog
title: "Please choose a background"
@ -205,6 +200,13 @@ Controls.Page {
mainPageArea.pop(Controls.StackView.Immediate)
}
function present(present) {
if (present)
presentationWindow.showFullScreen();
else
presentationWindow.close();
}
function updateLyrics(lyrics) {
songsqlmodel.updateLyrics(song, lyrics);
}

View file

@ -8,19 +8,26 @@ import org.presenter 1.0
Kirigami.OverlaySheet {
property ListModel model
property ListModel theModel
id: root
header: Kirigami.Heading {
text: "Settings"
}
/* Component.onCompleted: { */
/* showPassiveNotification(screenModel.get(1).name) */
/* } */
Kirigami.FormLayout {
Controls.ComboBox {
id: screenSelectionField
Kirigami.FormData.label: i18nc("@label:textbox", "Screen:")
model: model
textRole: name
onAccepted: descriptionField.forceActiveFocus()
Kirigami.FormData.label: i18nc("@label:textbox", "Presentation Screen:")
model: screens
textRole: "name"
onActivated: {
presentationScreen = screens[currentIndex];
}
}
Controls.TextField {
id: descriptionField