-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathllamaspinner.h
More file actions
49 lines (38 loc) · 1.3 KB
/
llamaspinner.h
File metadata and controls
49 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include <QImageIOHandler>
#include <QImageIOPlugin>
#include <QVector>
namespace LlamaCpp {
class SpinnerPlugin : public QImageIOPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE
"llamaspinner.json")
public:
Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
QImageIOHandler *create(QIODevice *device, const QByteArray &format) const override;
};
class SpinnerHandler : public QImageIOHandler
{
public:
explicit SpinnerHandler();
bool canRead() const override;
bool read(QImage *image) override;
bool jumpToImage(int imageNumber) override;
int currentImageNumber() const override;
int imageCount() const override;
int loopCount() const override;
int nextImageDelay() const override;
QByteArray name() const;
bool supportsOption(ImageOption option) const override;
void setOption(ImageOption option, const QVariant &value) override;
QVariant option(ImageOption option) const override;
private:
int frameIndex = 0;
QSize m_size{64, 64};
QColor backgroundColor{Qt::transparent};
QColor foregroundColor{Qt::black};
QImage::Format m_imageFormat{QImage::Format_ARGB32};
int delay{33};
};
} // namespace LlamaCpp