adding overload function for pdfs
This commit is contained in:
parent
ed58e2cda1
commit
e4b97b901f
4 changed files with 57 additions and 5 deletions
|
@ -6,6 +6,7 @@
|
|||
#include <QSqlRecord>
|
||||
#include <QSqlQuery>
|
||||
#include <QSql>
|
||||
// #include <QPdfDocument>
|
||||
#include <QSqlDatabase>
|
||||
#include <QFileInfo>
|
||||
#include <qabstractitemmodel.h>
|
||||
|
|
|
@ -134,11 +134,14 @@ Controls.Page {
|
|||
print("index grabbed: " + index);
|
||||
print(item);
|
||||
|
||||
presentation.stopVideo()
|
||||
presentation.stopVideo();
|
||||
presentation.itemType = item.type;
|
||||
print("Time to start changing");
|
||||
|
||||
SlideObject.changeSlide(item);
|
||||
if (item.type == "pres")
|
||||
SlideObject.changeSlide(item);
|
||||
else
|
||||
SlideObject.changeSlide(item);
|
||||
|
||||
if (item.backgroundType === "video")
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "slide.h"
|
||||
#include "serviceitemmodel.h"
|
||||
// #include <QPdfDocument>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
@ -12,12 +13,12 @@ Slide::Slide(QObject *parent)
|
|||
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, const bool &isPlaying,
|
||||
const int &fontSize, const int &imageCount, const bool &isPlaying,
|
||||
const QString &type, 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),m_isPlaying(isPlaying),m_type(type)
|
||||
m_fontSize(fontSize),m_imageCount(imageCount),m_isPlaying(isPlaying),m_type(type)
|
||||
{
|
||||
qDebug() << "Initializing slide with defaults";
|
||||
}
|
||||
|
@ -68,6 +69,11 @@ int Slide::fontSize() const
|
|||
return m_fontSize;
|
||||
}
|
||||
|
||||
int Slide::imageCount() const
|
||||
{
|
||||
return m_imageCount;
|
||||
}
|
||||
|
||||
bool Slide::isPlaying() const
|
||||
{
|
||||
return m_isPlaying;
|
||||
|
@ -168,6 +174,15 @@ void Slide::setFontSize(int fontSize)
|
|||
emit fontSizeChanged(m_fontSize);
|
||||
}
|
||||
|
||||
void Slide::setImageCount(int imageCount)
|
||||
{
|
||||
if (m_imageCount == imageCount)
|
||||
return;
|
||||
|
||||
m_imageCount = imageCount;
|
||||
emit imageCountChanged(m_imageCount);
|
||||
}
|
||||
|
||||
void Slide::changeSlide(QVariantMap item)
|
||||
{
|
||||
setServiceItem(item);
|
||||
|
@ -197,6 +212,33 @@ void Slide::changeSlide(QVariantMap item)
|
|||
qDebug() << "MAP: " << m_serviceItem.value("text");
|
||||
}
|
||||
|
||||
void Slide::changeSlide(QVariantMap item, int pageCount)
|
||||
{
|
||||
setServiceItem(item);
|
||||
setType(m_serviceItem.value("type").toString());
|
||||
|
||||
if (serviceItem().value("backgroundType") == "image") {
|
||||
setImageBackground(m_serviceItem.value("background").toString());
|
||||
setVideoBackground("");
|
||||
} else {
|
||||
setVideoBackground(m_serviceItem.value("background").toString());
|
||||
setImageBackground("");
|
||||
}
|
||||
|
||||
qDebug() << pageCount;
|
||||
|
||||
if (serviceItem().value("type") == "pres") {
|
||||
qDebug() << "#$#$#$#$#$ THIS A PDF #$#$#$#$#$#";
|
||||
}
|
||||
|
||||
QStringList text = m_serviceItem.value("text").toStringList();
|
||||
if (text.isEmpty()) {
|
||||
setText("");
|
||||
m_slideSize = 1;
|
||||
m_slideIndex = 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool Slide::next(QVariantMap nextItem)
|
||||
{
|
||||
qDebug() << "Starting to go to next item.";
|
||||
|
|
|
@ -21,6 +21,7 @@ class Slide : public QObject
|
|||
WRITE setVerticalTextAlignment NOTIFY verticalTextAlignmentChanged)
|
||||
Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged)
|
||||
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||
Q_PROPERTY(int imageCount READ imageCount WRITE setImageCount NOTIFY imageCountChanged)
|
||||
Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged)
|
||||
// QML_ELEMENT
|
||||
|
||||
|
@ -28,7 +29,7 @@ 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, const bool &isPlaying, const QString &type, QObject * parent = nullptr);
|
||||
const QString &font, const int &fontSize, const int &imageCount, const bool &isPlaying, const QString &type, QObject * parent = nullptr);
|
||||
|
||||
QString text() const;
|
||||
QString type() const;
|
||||
|
@ -40,6 +41,7 @@ public:
|
|||
QString verticalTextAlignment() const;
|
||||
QString font() const;
|
||||
int fontSize() const;
|
||||
int imageCount() const;
|
||||
bool isPlaying() const;
|
||||
|
||||
Q_INVOKABLE void setText(QString text);
|
||||
|
@ -52,8 +54,10 @@ public:
|
|||
Q_INVOKABLE void setVerticalTextAlignment(QString verticalTextAlignment);
|
||||
Q_INVOKABLE void setFont(QString font);
|
||||
Q_INVOKABLE void setFontSize(int fontSize);
|
||||
Q_INVOKABLE void setImageCount(int imageCount);
|
||||
|
||||
Q_INVOKABLE void changeSlide(QVariantMap item);
|
||||
Q_INVOKABLE void changeSlide(QVariantMap item, int pageCount);
|
||||
Q_INVOKABLE void play();
|
||||
Q_INVOKABLE void pause();
|
||||
Q_INVOKABLE void playPause();
|
||||
|
@ -71,6 +75,7 @@ signals:
|
|||
Q_INVOKABLE void verticalTextAlignmentChanged(QString verticalTextAlignment);
|
||||
Q_INVOKABLE void fontChanged(QString font);
|
||||
Q_INVOKABLE void fontSizeChanged(int fontSize);
|
||||
Q_INVOKABLE void imageCountChanged(int imageCount);
|
||||
Q_INVOKABLE void isPlayingChanged(bool isPlaying);
|
||||
|
||||
private:
|
||||
|
@ -85,6 +90,7 @@ private:
|
|||
QString m_verticalTextAlignment;
|
||||
QString m_font;
|
||||
int m_fontSize;
|
||||
int m_imageCount;
|
||||
bool m_isPlaying;
|
||||
|
||||
int m_slideIndex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue