WebImage.h 933 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#ifndef WEBIMAGE_H
#define WEBIMAGE_H

#include <inttypes.h>
#include <QImage>
#include <QSharedPointer>

class WebImage
{
public:
    WebImage();

    void clear(void);

    enum State
    {
        UNINITIALIZED = 0,
        REQUESTED = 1,
        READY = 2
    };

    State getState(void) const;
    void setState(State state);

25
    const QString& getSourceURL(void) const;
26 27 28
    void setSourceURL(const QString& url);

    const uint8_t* getData(void) const;
29 30
    void setData(const QByteArray& data);

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    int32_t getWidth(void) const;
    int32_t getHeight(void) const;

    uint64_t getLastReference(void) const;
    void setLastReference(uint64_t value);

    bool getSyncFlag(void) const;
    void setSyncFlag(bool onoff);

private:
    State state;
    QString sourceURL;
    QSharedPointer<QImage> image;
    uint64_t lastReference;
    bool syncFlag;
};

typedef QSharedPointer<WebImage> WebImagePtr;

#endif // WEBIMAGE_H