more basic ui

This commit is contained in:
Chris Cochrun 2022-02-08 15:03:41 -06:00
parent 8f4c2a4e94
commit f2a10ebfcc
31 changed files with 1020 additions and 1210 deletions

View file

@ -13,7 +13,6 @@ target_link_libraries(presenter
Qt5::Widgets
KF5::Kirigami2
KF5::I18n
)
target_compile_options (presenter PUBLIC -fexceptions)

View file

@ -1,35 +0,0 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtMultimedia 5.15
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
Item {
id: root
Rectangle {
id: rootBG
TextInput {
id: serviceNameInput
anchors.left: parent.left
anchors.right: parent.right
}
Controls.Label {
id: detailsLabel
anchors.top: serviceNameInput.bottom
anchors.topMargin: 20
}
ListView {
id: serviceList
}
}
}

View file

@ -1,133 +0,0 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtMultimedia 5.15
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
Component {
id: root
Kirigami.ScrollablePage {
id: mainPage
title: "Presenter"
actions {
main: Kirigami.Action {
icon.name: "fileopen"
text: "VideoBG"
onTriggered: {
print("Action button in buttons page clicked");
fileDialog.open()
}
}
right: Kirigami.Action {
icon.name: "view-presentation"
text: "Go Live"
onTriggered: {
print("Window is loading")
presentLoader.active = true
}
}
}
/* Kirigami.OverlaySheet { */
/* id: sheet */
/* onSheetOpenChanged: page.actions.main.checked = sheetOpen */
/* Controls.Label { */
/* wrapMode: Text.WordWrap */
/* text: "Lorem ipsum dolor sit amet" */
/* } */
/* } */
//Page contents...
Rectangle {
id: bg
anchors.fill: parent
color: "blue"
}
FileDialog {
id: fileDialog
title: "Please choose a video"
folder: shortcuts.home
selectMultiple: false
onAccepted: {
print("You chose: " + fileDialog.fileUrls)
video = fileDialog.fileUrl
}
onRejected: {
print("Canceled")
/* Qt.quit() */
}
}
Loader {
id: presentLoader
active: false
sourceComponent: Window {
id: presentWindow
title: "presentation-window"
height: maximumHeight
width: maximumWidth
visible: true
onClosing: presentLoader.active = false
Component.onCompleted: {
presentWindow.showFullScreen();
}
Item {
id: basePresentationLayer
anchors.fill: parent
Rectangle {
id: basePrColor
anchors.fill: parent
color: "black"
MediaPlayer {
id: videoPlayer
source: video
loops: MediaPlayer.Infinite
autoPlay: true
notifyInterval: 100
}
VideoOutput {
id: videoOutput
anchors.fill: parent
source: videoPlayer
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: videoPlayer.play();
}
Controls.ProgressBar {
id: progressBar
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 100
from: 0
to: videoPlayer.duraion
value: videoPlayer.position/videoPlayer.duration
height: 30
MouseArea {
anchors.fill: parent
onClicked: {
if (videoPlayer.seekable) {
videoPlayer.seek(videoPlayer.duration * mouse.x/width);
}
}
}
}
}
}
}
}
}
}

View file

@ -1,146 +0,0 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtMultimedia 5.15
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
Kirigami.ApplicationWindow {
id: root
property var video: null
pageStack.initialPage: mainPageComponent
Component {
id: mainPageComponent
Kirigami.ScrollablePage {
id: mainPage
title: "Presenter"
actions {
main: Kirigami.Action {
icon.name: "fileopen"
text: "VideoBG"
onTriggered: {
print("Action button in buttons page clicked");
fileDialog.open()
}
}
right: Kirigami.Action {
icon.name: "view-presentation"
text: "Go Live"
onTriggered: {
print("Window is loading")
presentLoader.active = true
}
}
}
Rectangle {
id: leftarea
color: "blue"
anchors.left: parent.left
width: parent.width / 2
}
Rectangle {
id: rightarea
color: "red"
anchors.left: leftarea.left
width: parent.width / 2
}
LeftDock {
id: leftDock
anchors.left: parent.left
width: parent.width / 4
}
FileDialog {
id: fileDialog
title: "Please choose a video"
folder: shortcuts.home
selectMultiple: false
onAccepted: {
print("You chose: " + fileDialog.fileUrls)
video = fileDialog.fileUrl
}
onRejected: {
print("Canceled")
/* Qt.quit() */
}
}
Loader {
id: presentLoader
active: false
sourceComponent: Window {
id: presentWindow
title: "presentation-window"
height: maximumHeight
width: maximumWidth
visible: true
onClosing: presentLoader.active = false
Component.onCompleted: {
presentWindow.showFullScreen();
}
Item {
id: basePresentationLayer
anchors.fill: parent
Rectangle {
id: basePrColor
anchors.fill: parent
color: "black"
MediaPlayer {
id: videoPlayer
source: video
loops: MediaPlayer.Infinite
autoPlay: true
notifyInterval: 100
}
VideoOutput {
id: videoOutput
anchors.fill: parent
source: videoPlayer
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: videoPlayer.play();
}
Controls.ProgressBar {
id: progressBar
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 100
from: 0
to: videoPlayer.duraion
value: videoPlayer.position/videoPlayer.duration
height: 30
MouseArea {
anchors.fill: parent
onClicked: {
if (videoPlayer.seekable) {
videoPlayer.seek(videoPlayer.duration * mouse.x/width);
}
}
}
}
}
}
}
}
}
}
}

View file

@ -4,6 +4,8 @@
#include <QUrl>
#include <KLocalizedContext>
#include <KLocalizedString>
#include <iostream>
#include <QQmlEngine>
// #include "mpvobject.h"
@ -16,22 +18,19 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org"));
QCoreApplication::setApplicationName(QStringLiteral("Church Presenter"));
// path = QQmlEngine::importPathList()
std::cout << "Hello World!";
QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
engine.load(QUrl(QStringLiteral("qrc:qml/main.qml")));
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
#endif
// // Qt sets the locale in the QGuiApplication constructor, but libmpv
// // requires the LC_NUMERIC category to be set to "C", so change it back.
// std::setlocale(LC_NUMERIC, "C");
// qmlRegisterType<MpvObject>("mpv", 1, 0, "MpvObject");
if (engine.rootObjects().isEmpty()) {
return -1;
}

20
src/qml/main.qml Normal file
View file

@ -0,0 +1,20 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtMultimedia 5.15
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
import "./presenter" as Presenter
Kirigami.ApplicationWindow {
id: root
pageStack.initialPage: mainPage
Presenter.MainWindow {
id: mainPage
}
}

View file

@ -0,0 +1,117 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtMultimedia 5.15
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
ListView {
id: serviceItemList
model: listModel
delegate: itemDelegate
/* flickDeceleration: 2000 */
ListModel {
id: listModel
ListElement {
itemName: "10,000 Reason"
type: "song"
}
ListElement {
itemName: "Marvelous Light"
type: "song"
}
ListElement {
itemName: "10 reason to use church presenter"
type: "video"
}
ListElement {
itemName: "10,000 Reason"
type: "song"
}
ListElement {
itemName: "Marvelous Light"
type: "song"
}
ListElement {
itemName: "10 reason to use church presenter"
type: "video"
}
ListElement {
itemName: "10,000 Reason"
type: "song"
}
ListElement {
itemName: "Marvelous Light"
type: "song"
}
ListElement {
itemName: "10 reason to use church presenter"
type: "video"
}
ListElement {
itemName: "10,000 Reason"
type: "song"
}
ListElement {
itemName: "Marvelous Light"
type: "song"
}
ListElement {
itemName: "10 reason to use church presenter"
type: "video"
}
ListElement {
itemName: "10,000 Reason"
type: "song"
}
ListElement {
itemName: "Marvelous Light"
type: "song"
}
ListElement {
itemName: "10 reason to use church presenter"
type: "video"
}
ListElement {
itemName: "10,000 Reason"
type: "song"
}
ListElement {
itemName: "Marvelous Light"
type: "song"
}
ListElement {
itemName: "10 reason to use church presenter"
type: "video"
}
}
Component {
id: itemDelegate
Kirigami.BasicListItem {
width: serviceItemList.width
height:50
label: itemName
subtitle: type
hoverEnabled: true
onClicked: serviceItemList.currentIndex = index
}
}
Kirigami.WheelHandler {
id: wheelHandler
target: serviceItemList
filterMouseEvents: true
keyNavigationEnabled: true
}
Controls.ScrollBar.vertical: Controls.ScrollBar {
anchors.right: serviceItemList.right
anchors.leftMargin: 10
active: hovered || pressed
}
}

View file

@ -0,0 +1,153 @@
import QtQuick 2.13
import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.0 as Controls
import QtQuick.Window 2.13
import QtQuick.Layouts 1.2
import QtMultimedia 5.15
import QtAudioEngine 1.15
import org.kde.kirigami 2.13 as Kirigami
import "./" as Presenter
Kirigami.Page {
id: mainPage
title: "Presenter"
padding: 0
property var video: null
actions {
main: Kirigami.Action {
icon.name: "fileopen"
text: "VideoBG"
onTriggered: {
print("Action button in buttons page clicked");
fileDialog.open()
}
}
right: Kirigami.Action {
icon.name: "view-presentation"
text: "Go Live"
onTriggered: {
print("Window is loading")
presentLoader.active = true
}
}
}
Item {
id: mainItem
anchors.fill: parent
height: parent.height
GridLayout {
id: gridLayout
anchors.fill: parent
height: parent.height
columns: 3
rows: 2
Presenter.LeftDock {
id: leftDock
Layout.fillHeight: true
implicitWidth: 200
}
Rectangle {
id: leftDockBorder
color: "lightblue"
Layout.fillHeight: true
width: 2
}
Rectangle {
id: rightMainArea
color: "red"
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
FileDialog {
id: fileDialog
title: "Please choose a video"
folder: shortcuts.home
selectMultiple: false
onAccepted: {
print("You chose: " + fileDialog.fileUrls)
video = fileDialog.fileUrl
}
onRejected: {
print("Canceled")
/* Qt.quit() */
}
}
Loader {
id: presentLoader
active: false
sourceComponent: Window {
id: presentWindow
title: "presentation-window"
height: maximumHeight
width: maximumWidth
visible: true
onClosing: presentLoader.active = false
Component.onCompleted: {
presentWindow.showFullScreen();
}
Item {
id: basePresentationLayer
anchors.fill: parent
Rectangle {
id: basePrColor
anchors.fill: parent
color: "black"
MediaPlayer {
id: videoPlayer
source: video
loops: MediaPlayer.Infinite
autoPlay: true
notifyInterval: 100
}
VideoOutput {
id: videoOutput
anchors.fill: parent
source: videoPlayer
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: videoPlayer.play();
}
Controls.ProgressBar {
id: progressBar
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 100
from: 0
to: videoPlayer.duraion
value: videoPlayer.position/videoPlayer.duration
height: 30
MouseArea {
anchors.fill: parent
onClicked: {
if (videoPlayer.seekable) {
videoPlayer.seek(videoPlayer.duration * mouse.x/width);
}
}
}
}
}
}
}
}
}

3
src/qml/presenter/qmldir Normal file
View file

@ -0,0 +1,3 @@
module presenter
MainWindow 1.0 MainWindow.qml
LeftDock 1.0 LeftDock.qml

View file

@ -1,6 +1,8 @@
<RCC>
<qresource prefix="/">
<file alias="main.qml">contents/ui/main.qml</file>
<file alias="main.qml">contents/ui/LeftDock.qml</file>
<file>qml/main.qml</file>
<file>qml/presenter/qmldir</file>
<file>qml/presenter/LeftDock.qml</file>
<file>qml/presenter/MainWindow.qml</file>
</qresource>
</RCC>