some basic ui pieces
This commit is contained in:
parent
9c73c8c567
commit
8f4c2a4e94
52 changed files with 1251 additions and 1906 deletions
|
@ -1,2 +1,19 @@
|
|||
add_executable(helloworld main.cpp resources.qrc)
|
||||
target_link_libraries(helloworld Qt5::Quick Qt5::Qml Qt5::Gui Qt5::QuickControls2 Qt5::Widgets KF5::Kirigami2 KF5::I18n)
|
||||
add_executable(presenter)
|
||||
|
||||
target_sources(presenter
|
||||
PRIVATE
|
||||
main.cpp resources.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(presenter
|
||||
Qt5::Quick
|
||||
Qt5::Qml
|
||||
Qt5::Gui
|
||||
Qt5::QuickControls2
|
||||
Qt5::Widgets
|
||||
KF5::Kirigami2
|
||||
KF5::I18n
|
||||
|
||||
)
|
||||
|
||||
target_compile_options (presenter PUBLIC -fexceptions)
|
||||
|
|
35
src/contents/ui/LeftDock.qml
Normal file
35
src/contents/ui/LeftDock.qml
Normal file
|
@ -0,0 +1,35 @@
|
|||
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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
133
src/contents/ui/MainWindow.qml
Normal file
133
src/contents/ui/MainWindow.qml
Normal file
|
@ -0,0 +1,133 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,146 @@
|
|||
import QtQuick 2.6
|
||||
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
|
||||
|
||||
// Base element, provides basic features needed for all kirigami applications
|
||||
Kirigami.ApplicationWindow {
|
||||
// ID provides unique identifier to reference this element
|
||||
id: root
|
||||
property var video: null
|
||||
|
||||
// Window title
|
||||
// i18nc is useful for adding context for translators, also lets strings be changed for different languages
|
||||
title: i18nc("@title:window", "Hello World")
|
||||
pageStack.initialPage: mainPageComponent
|
||||
Component {
|
||||
id: mainPageComponent
|
||||
|
||||
// Initial page to be loaded on app load
|
||||
pageStack.initialPage: Kirigami.Page {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
// Center label horizontally and vertically within parent element
|
||||
anchors.centerIn: parent
|
||||
text: i18n("Hello World!")
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
21
src/main.cpp
21
src/main.cpp
|
@ -5,20 +5,33 @@
|
|||
#include <KLocalizedContext>
|
||||
#include <KLocalizedString>
|
||||
|
||||
// #include "mpvobject.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication app(argc, argv);
|
||||
KLocalizedString::setApplicationDomain("helloworld");
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
|
||||
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("Hello World"));
|
||||
KLocalizedString::setApplicationDomain("presenter");
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("TFC"));
|
||||
QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("Church Presenter"));
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
engine.load(QUrl(QStringLiteral("qrc:/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;
|
||||
}
|
||||
|
|
11
src/present.desktop
Normal file
11
src/present.desktop
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=present
|
||||
GenericName=Church Presentation
|
||||
Comment=A Kirigami base church presenter
|
||||
Exec=present %U
|
||||
TryExec=present
|
||||
Icon=present
|
||||
StartupNotify=true
|
||||
Terminal=false
|
||||
Categories=presentation
|
BIN
src/present.png
Normal file
BIN
src/present.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 765 B |
|
@ -1,5 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file alias="main.qml">contents/ui/main.qml</file>
|
||||
<file alias="main.qml">contents/ui/LeftDock.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue