adding a thumbnail class to create better thumbnails
This commit is contained in:
parent
4c76156489
commit
6fc15c6f47
2 changed files with 233 additions and 0 deletions
159
src/thumbnail.cpp
Normal file
159
src/thumbnail.cpp
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
#include "thumbnail.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
Thumbnail::Thumbnail(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Thumbnail::Thumbnail(const QString &owner, const QString &type, QObject *parent)
|
||||||
|
: QObject(parent),m_owner(owner),m_type(type)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Thumbnail::Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, QObject *parent)
|
||||||
|
: QObject(parent),m_owner(owner),m_type(type),m_background(background),
|
||||||
|
m_backgroundType(backgroundType)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Thumbnail::Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
QObject *parent)
|
||||||
|
: QObject(parent),m_owner(owner),m_type(type),m_background(background),
|
||||||
|
m_backgroundType(backgroundType),m_text(text)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Thumbnail::Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
const QString &songVerse, QObject *parent)
|
||||||
|
: QObject(parent),m_owner(owner),m_type(type),m_background(background),
|
||||||
|
m_backgroundType(backgroundType),m_text(text),m_songVerse(songVerse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Thumbnail::Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
const QString &font, const int &fontSize, const QString &songVerse
|
||||||
|
QObject *parent)
|
||||||
|
: QObject(parent),m_owner(owner),m_type(type),m_background(background),
|
||||||
|
m_backgroundType(backgroundType),m_text(text),m_font(font),m_fontSize(fontSize),
|
||||||
|
m_songVerse(songVerse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Thumbnail::owner() const {
|
||||||
|
return m_owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Thumbnail::type() const {
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Thumbnail::songVerse() const {
|
||||||
|
return m_songVerse;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Thumbnail::background() const
|
||||||
|
{
|
||||||
|
return m_background;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Thumbnail::backgroundType() const
|
||||||
|
{
|
||||||
|
return m_backgroundType;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList Thumbnail::text() const
|
||||||
|
{
|
||||||
|
return m_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Thumbnail::font() const {
|
||||||
|
return m_font;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Thumbnail::fontSize() const {
|
||||||
|
return m_fontSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setOwner(QString owner)
|
||||||
|
{
|
||||||
|
if (m_owner == owner)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_owner = owner;
|
||||||
|
emit ownerChanged(m_owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setType(QString type)
|
||||||
|
{
|
||||||
|
if (m_type == type)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_type = type;
|
||||||
|
emit typeChanged(m_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setSongVerse(QString songVerse)
|
||||||
|
{
|
||||||
|
if (m_songVerse == songVerse)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_songVerse = songVerse;
|
||||||
|
emit songVerseChanged(m_songVerse);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setBackground(QString background)
|
||||||
|
{
|
||||||
|
if (m_background == background)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_background = background;
|
||||||
|
emit backgroundChanged(m_background);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setBackgroundType(QString backgroundType)
|
||||||
|
{
|
||||||
|
if (m_backgroundType == backgroundType)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_backgroundType = backgroundType;
|
||||||
|
emit backgroundTypeChanged(m_backgroundType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setText(QStringList text)
|
||||||
|
{
|
||||||
|
if (m_text == text)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_text = text;
|
||||||
|
emit textChanged(m_text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setFont(QString font)
|
||||||
|
{
|
||||||
|
if (m_font == font)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_font = font;
|
||||||
|
emit fontChanged(m_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Thumbnail::setFontSize(int fontSize)
|
||||||
|
{
|
||||||
|
if (m_fontSize == fontSize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_fontSize = fontSize;
|
||||||
|
emit fontSizeChanged(m_fontSize);
|
||||||
|
}
|
74
src/thumbnail.h
Normal file
74
src/thumbnail.h
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
#ifndef THUMBNAIL_H
|
||||||
|
#define THUMBNAIL_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <qobject.h>
|
||||||
|
|
||||||
|
class Thumbnail : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString owner READ owner WRITE setOwner NOTIFY ownerChanged)
|
||||||
|
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
|
||||||
|
Q_PROPERTY(QString songVerse READ songVerse WRITE setSongVerse NOTIFY songVerseChanged)
|
||||||
|
Q_PROPERTY(QString background READ background WRITE setBackground NOTIFY backgroundChanged)
|
||||||
|
Q_PROPERTY(QString backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged)
|
||||||
|
Q_PROPERTY(QStringList text READ text WRITE setText NOTIFY textChanged)
|
||||||
|
Q_PROPERTY(QString font READ font WRITE setFont NOTIFY fontChanged)
|
||||||
|
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Thumbnail(QObject *parent = nullptr);
|
||||||
|
Thumbnail(const QString &owner, const QString &type, QObject * parent = nullptr);
|
||||||
|
Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, QObject * parent = nullptr);
|
||||||
|
Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
QObject * parent = nullptr);
|
||||||
|
Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
const QString &songVerse, QObject * parent = nullptr);
|
||||||
|
Thumbnail(const QString &owner, const QString &type, const QString &background,
|
||||||
|
const QString &backgroundType, const QStringList &text,
|
||||||
|
const QString &songVerse, const QString &font,
|
||||||
|
const int &fontSize, QObject * parent = nullptr);
|
||||||
|
|
||||||
|
QString owner() const;
|
||||||
|
QString type() const;
|
||||||
|
QString songVerse() const;
|
||||||
|
QString background() const;
|
||||||
|
QString backgroundType() const;
|
||||||
|
QStringList text() const;
|
||||||
|
QString font() const;
|
||||||
|
int fontSize() const;
|
||||||
|
|
||||||
|
void setOwner(QString owner);
|
||||||
|
void setType(QString type);
|
||||||
|
void setSongVerse(QString songVerse);
|
||||||
|
void setBackground(QString background);
|
||||||
|
void setBackgroundType(QString backgroundType);
|
||||||
|
void setText(QStringList text);
|
||||||
|
void setFont(QString font);
|
||||||
|
void setFontSize(int fontSize);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ownerChanged(QString owner);
|
||||||
|
void typeChanged(QString type);
|
||||||
|
void songVerseChanged(QString songVerse);
|
||||||
|
void backgroundChanged(QString background);
|
||||||
|
void backgroundTypeChanged(QString backgroundType);
|
||||||
|
void textChanged(QStringList text);
|
||||||
|
void fontChanged(QString font);
|
||||||
|
void fontSizeChanged(int fontSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_owner;
|
||||||
|
QString m_type;
|
||||||
|
QString m_songVerse;
|
||||||
|
QString m_background;
|
||||||
|
QString m_backgroundType;
|
||||||
|
QStringList m_text;
|
||||||
|
QString m_font;
|
||||||
|
int m_fontSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // THUMBNAIL_H
|
Loading…
Add table
Add a link
Reference in a new issue