-
Notifications
You must be signed in to change notification settings - Fork 4
/
substancepresetpreview.h
65 lines (49 loc) · 1.49 KB
/
substancepresetpreview.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef SUBSTANCEPRESETPREVIEW_H
#define SUBSTANCEPRESETPREVIEW_H
#include <QCache>
#include <QLabel>
#include <QProcess>
#include <QWidget>
#include "sbspreset.h"
#include "processmanager.h"
class SubstancePresetPreview: public QWidget
{
Q_OBJECT
public:
SubstancePresetPreview();
~SubstancePresetPreview();
// required
void SetPresetAndRenderPreview(SBSPreset* preset);
void SetPreviewSize(QSize size);
// forces re-render [update cache]
// if displayLoader will immediately sgow loader
void ForceReRender(bool displayLoader = false);
// internal but exposed
void RenderPreview(bool useCache = true, bool dontRequestRender = false);
void PostRenderPreview();
// Custom widget
void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *event);
// label enabled
void SetLabelEnabled(bool enable);
QString GetCacheDir();
QProcess process;
SBSPreset* preset() const;
QPixmap texture() const;
bool isLoading() const;
QColor messageColor = QColor();
QString messageText = "Loading...\n";
static QCache<QString, QImage> imageCache;
static QImage LoadImageThroughCache(QString cacheKey, bool useCache = true);
static void ClearCacheForDir(QString prefix);
public slots:
void OnSBSRenderCompleted(PresetRender* p);
private:
SBSPreset* m_preset;
bool m_isLoading;
QSize m_size;
int lgx, lgy;
QPixmap m_texture;
QLabel* m_label;
};
#endif // SUBSTANCEPRESETPREVIEW_H