2022-08-25 18:37:24 +08:00
|
|
|
#ifndef EPHOTO_H
|
|
|
|
#define EPHOTO_H
|
|
|
|
|
|
|
|
#include "ebase.h"
|
|
|
|
#include "pagelistitem.h"
|
2025-05-23 18:35:00 +08:00
|
|
|
#include "synctimer.h"
|
|
|
|
|
|
|
|
struct Frame {
|
|
|
|
QPixmap img;
|
|
|
|
int dur = 100;
|
|
|
|
};
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
class EPhoto : public EBase {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2025-05-23 18:35:00 +08:00
|
|
|
static QString filters() { return tr("Images (*.png *.jpg *.jpeg *.bmp *.gif)"); }
|
|
|
|
static EPhoto *create(const JObj &, PageListItem *pageItem, EBase *multiWin = 0);
|
2022-08-25 18:37:24 +08:00
|
|
|
|
2025-05-23 18:35:00 +08:00
|
|
|
explicit EPhoto(QImageReader &reader, const QImage &, const QString &dir, const QString &name, const JObj &json, EBase *multiWin = 0);
|
2022-08-25 18:37:24 +08:00
|
|
|
|
2024-02-21 18:08:50 +08:00
|
|
|
int type() const override { return EBase::Image; }
|
2022-08-25 18:37:24 +08:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
2023-10-23 14:58:29 +08:00
|
|
|
JObj attrJson() const override;
|
2022-08-25 18:37:24 +08:00
|
|
|
bool save(const QString &pageDir) override;
|
|
|
|
QWidget* attrWgt() override;
|
|
|
|
|
|
|
|
QImage img;
|
2025-05-23 18:35:00 +08:00
|
|
|
std::vector<Frame> frames;
|
2025-05-06 18:28:05 +08:00
|
|
|
QString mDir, mName, direct;
|
2025-05-23 18:35:00 +08:00
|
|
|
int fi = 0, speed = 0, tailSpacing = 0;
|
|
|
|
public slots:
|
|
|
|
void sltNext();
|
2022-08-25 18:37:24 +08:00
|
|
|
protected:
|
2025-05-23 18:35:00 +08:00
|
|
|
SyncTimer* timer = 0;
|
2022-08-25 18:37:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EPHOTO_H
|