75 lines
2.1 KiB
C++
75 lines
2.1 KiB
C++
#ifndef EPHOTO_H
|
|
#define EPHOTO_H
|
|
|
|
#include <QPainter>
|
|
#include <QImage>
|
|
#include "eobject.h"
|
|
#include "QProcess"
|
|
class ePhoto : public eObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum EnterStyle {
|
|
NoneStyle = 0,
|
|
Expanding2Left,
|
|
Expanding2Right,
|
|
Expanding2Top,
|
|
Expanding2Bottom,
|
|
ExpandingFromCenter
|
|
};
|
|
|
|
struct Data {
|
|
QString name;
|
|
QString computer_pic_file;
|
|
QString yuanshi_name;
|
|
QString path;
|
|
int playDuration=10;
|
|
int playTimes;
|
|
int enterStyle;
|
|
int enterDuration;
|
|
};
|
|
|
|
public:
|
|
explicit ePhoto(QRectF rectInit,const QString &file, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
|
|
explicit ePhoto(QRectF rectInit,QSizeF DrawBoardSize,const QString &file, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
|
|
explicit ePhoto(const QJsonObject &json, const QString &pRoot, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
|
|
QImage * GetCurImage(){return &m_photo;}
|
|
void CropCurImage(QRect rt);
|
|
public:
|
|
static void setElement(const QJsonObject &json, Data &attr);
|
|
Data getData(){return m_attr;}
|
|
|
|
public:
|
|
static QString filters() { return tr("Images (*.png *.jpg *.jpeg *.bmp)"); }
|
|
void deleteContent();
|
|
public:
|
|
virtual int type() const override { return eObject::Photo; }
|
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
virtual QWidget* wAttr() override;
|
|
virtual QWidget* wAttrElement() override;
|
|
virtual QJsonObject save(const QString &pRoot) override;
|
|
virtual QStringList filesList() const override;
|
|
virtual QJsonObject elementJson() const override;
|
|
|
|
signals:
|
|
|
|
public slots:
|
|
int onResChanged(const QString &file);
|
|
void onAttrChanged(const ePhoto::Data &data);
|
|
void ConvertImage(int,QProcess::ExitStatus);
|
|
|
|
protected:
|
|
void setPlayArg(int pd, int pt, int es, int ed);
|
|
|
|
private:
|
|
QImage m_photo;
|
|
Data m_attr;
|
|
bool m_CropFlag=false;
|
|
QProcess *process=nullptr;
|
|
QString m_strNewFileName;
|
|
QRectF m_rectInit;
|
|
QSizeF m_DrawBoardSize;
|
|
};
|
|
|
|
#endif // EPHOTO_H
|