trying to add slide class as master controller for the slide
This commit is contained in:
parent
99afdd0b0f
commit
12a5b0bcf1
8 changed files with 220 additions and 4 deletions
|
@ -6,6 +6,7 @@ target_sources(presenter
|
||||||
songsqlmodel.cpp songsqlmodel.h
|
songsqlmodel.cpp songsqlmodel.h
|
||||||
serviceitemmodel.cpp serviceitemmodel.h
|
serviceitemmodel.cpp serviceitemmodel.h
|
||||||
serviceitem.cpp serviceitem.h
|
serviceitem.cpp serviceitem.h
|
||||||
|
slide.cpp slide.h
|
||||||
videosqlmodel.cpp videosqlmodel.h
|
videosqlmodel.cpp videosqlmodel.h
|
||||||
imagesqlmodel.cpp imagesqlmodel.h
|
imagesqlmodel.cpp imagesqlmodel.h
|
||||||
mpv/mpvobject.h mpv/mpvobject.cpp
|
mpv/mpvobject.h mpv/mpvobject.cpp
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "songsqlmodel.h"
|
#include "songsqlmodel.h"
|
||||||
#include "videosqlmodel.h"
|
#include "videosqlmodel.h"
|
||||||
#include "imagesqlmodel.h"
|
#include "imagesqlmodel.h"
|
||||||
|
#include "slide.h"
|
||||||
|
|
||||||
static void connectToDatabase() {
|
static void connectToDatabase() {
|
||||||
// let's setup our sql database
|
// let's setup our sql database
|
||||||
|
@ -92,6 +93,10 @@ int main(int argc, char *argv[])
|
||||||
qDebug() << QQuickStyle::availableStyles();
|
qDebug() << QQuickStyle::availableStyles();
|
||||||
qDebug() << QIcon::themeName();
|
qDebug() << QIcon::themeName();
|
||||||
|
|
||||||
|
//Need to instantiate our slide
|
||||||
|
Slide slide("", "", "", "", "", "", "", 0);
|
||||||
|
// QScopedPointer<Slide> slide("", "", "", "", "", "", "", 0);
|
||||||
|
|
||||||
// apparently mpv needs this class set
|
// apparently mpv needs this class set
|
||||||
// let's register mpv as well
|
// let's register mpv as well
|
||||||
std::setlocale(LC_NUMERIC, "C");
|
std::setlocale(LC_NUMERIC, "C");
|
||||||
|
@ -102,6 +107,7 @@ int main(int argc, char *argv[])
|
||||||
qmlRegisterType<VideoSqlModel>("org.presenter", 1, 0, "VideoSqlModel");
|
qmlRegisterType<VideoSqlModel>("org.presenter", 1, 0, "VideoSqlModel");
|
||||||
qmlRegisterType<ImageSqlModel>("org.presenter", 1, 0, "ImageSqlModel");
|
qmlRegisterType<ImageSqlModel>("org.presenter", 1, 0, "ImageSqlModel");
|
||||||
qmlRegisterType<ServiceItemModel>("org.presenter", 1, 0, "ServiceItemModel");
|
qmlRegisterType<ServiceItemModel>("org.presenter", 1, 0, "ServiceItemModel");
|
||||||
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", &slide);
|
||||||
|
|
||||||
connectToDatabase();
|
connectToDatabase();
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,9 @@ Controls.Page {
|
||||||
const item = serviceItemModel.getItem(index);
|
const item = serviceItemModel.getItem(index);
|
||||||
print("index grabbed: " + index);
|
print("index grabbed: " + index);
|
||||||
|
|
||||||
|
slideObject.setImageBackground("/home/chris/Pictures/RoyalKing.png");
|
||||||
|
print("The slides backgorund is: " + slideObject.imageBackground);
|
||||||
|
|
||||||
presentation.stopVideo()
|
presentation.stopVideo()
|
||||||
presentation.itemType = item.type;
|
presentation.itemType = item.type;
|
||||||
print("Time to start changing");
|
print("Time to start changing");
|
||||||
|
|
|
@ -6,6 +6,7 @@ import QtQuick.Layouts 1.2
|
||||||
/* import QtAudioEngine 1.15 */
|
/* import QtAudioEngine 1.15 */
|
||||||
import org.kde.kirigami 2.13 as Kirigami
|
import org.kde.kirigami 2.13 as Kirigami
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
|
import org.presenter 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
@ -85,7 +86,7 @@ Item {
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
textSize: width / 15
|
textSize: width / 15
|
||||||
itemType: root.itemType
|
itemType: root.itemType
|
||||||
imageSource: imagebackground
|
imageSource: SlideObject.imageBackground
|
||||||
videoSource: vidbackground
|
videoSource: vidbackground
|
||||||
preview: true
|
preview: true
|
||||||
}
|
}
|
||||||
|
@ -121,6 +122,7 @@ Item {
|
||||||
|
|
||||||
function nextSlideAction() {
|
function nextSlideAction() {
|
||||||
print(textIndex);
|
print(textIndex);
|
||||||
|
print("YIPPEE KAYAYYYY!");
|
||||||
if (itemType === "song") {
|
if (itemType === "song") {
|
||||||
if (textIndex === 0) {
|
if (textIndex === 0) {
|
||||||
previewSlide.text = root.text[textIndex];
|
previewSlide.text = root.text[textIndex];
|
||||||
|
|
|
@ -20,7 +20,7 @@ Item {
|
||||||
property url imageSource: imageBackground
|
property url imageSource: imageBackground
|
||||||
property url videoSource: videoBackground
|
property url videoSource: videoBackground
|
||||||
property string chosenFont: "Quicksand"
|
property string chosenFont: "Quicksand"
|
||||||
property var text: "This is demo text"
|
property string text: "This is demo text"
|
||||||
property color backgroundColor
|
property color backgroundColor
|
||||||
property var hTextAlignment: Text.AlignHCenter
|
property var hTextAlignment: Text.AlignHCenter
|
||||||
property var vTextAlignment: Text.AlignVCenter
|
property var vTextAlignment: Text.AlignVCenter
|
||||||
|
|
|
@ -14,14 +14,16 @@ ServiceItem::ServiceItem(const QString &name, const QString &type, QObject *pare
|
||||||
|
|
||||||
ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background,
|
ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||||
const QString &backgroundType, QObject *parent)
|
const QString &backgroundType, QObject *parent)
|
||||||
: QObject(parent),m_name(name),m_type(type),m_background(background),m_backgroundType(backgroundType)
|
: QObject(parent),m_name(name),m_type(type),m_background(background),
|
||||||
|
m_backgroundType(backgroundType)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background,
|
ServiceItem::ServiceItem(const QString &name, const QString &type, const QString &background,
|
||||||
const QString &backgroundType, const QStringList &text, QObject *parent)
|
const QString &backgroundType, const QStringList &text, QObject *parent)
|
||||||
: QObject(parent),m_name(name),m_type(type),m_background(background),m_backgroundType(backgroundType),m_text(text)
|
: QObject(parent),m_name(name),m_type(type),m_background(background),
|
||||||
|
m_backgroundType(backgroundType),m_text(text)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
131
src/slide.cpp
Normal file
131
src/slide.cpp
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
#include "slide.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
Slide::Slide(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
qDebug() << "Initializing slide";
|
||||||
|
}
|
||||||
|
|
||||||
|
Slide::Slide(const QString &text, const QString &audio, const QString &imageBackground,
|
||||||
|
const QString &videoBackground, const QString &horizontalTextAlignment,
|
||||||
|
const QString &verticalTextAlignment, const QString &font,
|
||||||
|
const int &fontSize, QObject *parent)
|
||||||
|
: QObject(parent),m_text(text),m_audio(audio),m_imageBackground(imageBackground),
|
||||||
|
m_videoBackground(videoBackground),m_verticalTextAlignment(verticalTextAlignment),
|
||||||
|
m_horizontalTextAlignment(horizontalTextAlignment),m_font(font),m_fontSize(fontSize)
|
||||||
|
{
|
||||||
|
qDebug() << "Initializing slide with defaults";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::text() const {
|
||||||
|
return m_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::audio() const {
|
||||||
|
return m_audio;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::imageBackground() const
|
||||||
|
{
|
||||||
|
return m_imageBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::videoBackground() const
|
||||||
|
{
|
||||||
|
return m_videoBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::horizontalTextAlignment() const
|
||||||
|
{
|
||||||
|
return m_horizontalTextAlignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::verticalTextAlignment() const
|
||||||
|
{
|
||||||
|
return m_verticalTextAlignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Slide::font() const
|
||||||
|
{
|
||||||
|
return m_font;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Slide::fontSize() const
|
||||||
|
{
|
||||||
|
return m_fontSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setText(QString text)
|
||||||
|
{
|
||||||
|
if (m_text == text)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_text = text;
|
||||||
|
emit textChanged(m_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setAudio(QString audio)
|
||||||
|
{
|
||||||
|
if (m_audio == audio)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_audio = audio;
|
||||||
|
emit audioChanged(m_audio);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setImageBackground(QString imageBackground)
|
||||||
|
{
|
||||||
|
if (m_imageBackground == imageBackground)
|
||||||
|
return;
|
||||||
|
|
||||||
|
qDebug() << "changing image background to: " << imageBackground;
|
||||||
|
m_imageBackground = imageBackground;
|
||||||
|
emit imageBackgroundChanged(m_imageBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setVideoBackground(QString videoBackground)
|
||||||
|
{
|
||||||
|
if (m_videoBackground == videoBackground)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_videoBackground = videoBackground;
|
||||||
|
emit videoBackgroundChanged(m_videoBackground);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setHorizontalTextAlignment(QString horizontalTextAlignment)
|
||||||
|
{
|
||||||
|
if (m_horizontalTextAlignment == horizontalTextAlignment)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_horizontalTextAlignment = horizontalTextAlignment;
|
||||||
|
emit horizontalTextAlignmentChanged(m_horizontalTextAlignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setVerticalTextAlignment(QString verticalTextAlignment)
|
||||||
|
{
|
||||||
|
if (m_verticalTextAlignment == verticalTextAlignment)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_verticalTextAlignment = verticalTextAlignment;
|
||||||
|
emit verticalTextAlignmentChanged(m_verticalTextAlignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setFont(QString font)
|
||||||
|
{
|
||||||
|
if (m_font == font)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_font = font;
|
||||||
|
emit fontChanged(m_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Slide::setFontSize(int fontSize)
|
||||||
|
{
|
||||||
|
if (m_fontSize == fontSize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_fontSize = fontSize;
|
||||||
|
emit fontSizeChanged(m_fontSize);
|
||||||
|
}
|
71
src/slide.h
Normal file
71
src/slide.h
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
#ifndef SLIDE_H
|
||||||
|
#define SLIDE_H
|
||||||
|
|
||||||
|
#include <qobjectdefs.h>
|
||||||
|
#include <qqml.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <qobject.h>
|
||||||
|
|
||||||
|
class Slide : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
|
||||||
|
Q_PROPERTY(QString audio READ audio WRITE setAudio NOTIFY audioChanged)
|
||||||
|
Q_PROPERTY(QString imageBackground READ imageBackground WRITE setImageBackground NOTIFY imageBackgroundChanged)
|
||||||
|
Q_PROPERTY(QString videoBackground READ videoBackground WRITE setVideoBackground NOTIFY videoBackgroundChanged)
|
||||||
|
Q_PROPERTY(QString horizontalTextAlignment READ horizontalTextAlignment WRITE setHorizontalTextAlignment NOTIFY horizontalTextAlignmentChanged)
|
||||||
|
Q_PROPERTY(QString verticalTextAlignment READ verticalTextAlignment WRITE setVerticalTextAlignment NOTIFY verticalTextAlignmentChanged)
|
||||||
|
Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged)
|
||||||
|
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||||
|
QML_ELEMENT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Slide(QObject *parent = nullptr);
|
||||||
|
Slide(const QString &text, const QString &audio, const QString &imageBackground, const QString &videoBackground,
|
||||||
|
const QString &horizontalTextAlignment, const QString &verticalTextAlignment,
|
||||||
|
const QString &font, const int &fontSize, QObject * parent = nullptr);
|
||||||
|
|
||||||
|
QString text() const;
|
||||||
|
QString audio() const;
|
||||||
|
QString imageBackground() const;
|
||||||
|
QString videoBackground() const;
|
||||||
|
QString horizontalTextAlignment() const;
|
||||||
|
QString verticalTextAlignment() const;
|
||||||
|
QString font() const;
|
||||||
|
int fontSize() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void setText(QString text);
|
||||||
|
Q_INVOKABLE void setAudio(QString audio);
|
||||||
|
Q_INVOKABLE void setImageBackground(QString imageBackground);
|
||||||
|
Q_INVOKABLE void setVideoBackground(QString videoBackground);
|
||||||
|
Q_INVOKABLE void setHorizontalTextAlignment(QString horizontalTextAlignment);
|
||||||
|
Q_INVOKABLE void setVerticalTextAlignment(QString verticalTextAlignment);
|
||||||
|
Q_INVOKABLE void setFont(QString font);
|
||||||
|
Q_INVOKABLE void setFontSize(int fontSize);
|
||||||
|
|
||||||
|
// Q_INVOKABLE void changeSlide(int index);
|
||||||
|
// Q_INVOKABLE void nextSlide();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
Q_INVOKABLE void textChanged(QString text);
|
||||||
|
Q_INVOKABLE void audioChanged(QString audio);
|
||||||
|
Q_INVOKABLE void imageBackgroundChanged(QString imageBackground);
|
||||||
|
Q_INVOKABLE void videoBackgroundChanged(QString videoBackground);
|
||||||
|
Q_INVOKABLE void horizontalTextAlignmentChanged(QString horizontalTextAlignment);
|
||||||
|
Q_INVOKABLE void verticalTextAlignmentChanged(QString verticalTextAlignment);
|
||||||
|
Q_INVOKABLE void fontChanged(QString font);
|
||||||
|
Q_INVOKABLE void fontSizeChanged(int fontSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_id;
|
||||||
|
QString m_text;
|
||||||
|
QString m_audio;
|
||||||
|
QString m_imageBackground;
|
||||||
|
QString m_videoBackground;
|
||||||
|
QString m_horizontalTextAlignment;
|
||||||
|
QString m_verticalTextAlignment;
|
||||||
|
QString m_font;
|
||||||
|
int m_fontSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //SLIDE_H
|
Loading…
Add table
Add a link
Reference in a new issue