blob: 4b5ba0e552b621a44c645a74164c5bedc890591e (
plain)
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
|
#pragma once
#include "apbase.h"
#include "fields.h"
#include <QPixmap>
#include <array>
#include <memory>
class APAttachment : APBase {
public:
APAttachment();
APAttachment(APAttachmentFields fields);
~APAttachment() {};
QString get_html_render(HtmlRenderDetails render_info);
std::shared_ptr<QPixmap> get_pixmap(int width = 0, int height = 0);
private:
QString blurhash;
std::array<float, 2> focal_point = {0.,0.};
QString type; // MIME type, maps to "media_type"
QString description; // alt text, maps to "name"
QString path_url; // attachment URL, might be file on filesystem (make sure that the attachment dir has been found and that the path is correct)
QString filename; // nicer descriptor of the attachment's path
std::shared_ptr<QPixmap> pixmap;
struct {
int width = 0;
int height = 0;
// Compare with dimensions passed to get_pixmap()
inline bool is_equal(int comp_w, int comp_h) {
return width == comp_w and height == comp_h;
}
} pixmap_dimens; // requested dimensions of the pixmap
};
class APAttachmentList : public std::vector<APAttachment>, APBase {
public:
QString get_html_render(HtmlRenderDetails render_info);
};
|