Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/thumbnailer.h
- This file was moved from applets/notifications/plugin/thumbnailer.h.
Show All 29 Lines | |||||
30 | class Thumbnailer : public QObject, public QQmlParserStatus | 30 | class Thumbnailer : public QObject, public QQmlParserStatus | ||
31 | { | 31 | { | ||
32 | Q_OBJECT | 32 | Q_OBJECT | ||
33 | Q_INTERFACES(QQmlParserStatus) | 33 | Q_INTERFACES(QQmlParserStatus) | ||
34 | 34 | | |||
35 | Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) | 35 | Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) | ||
36 | Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged) | 36 | Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged) | ||
37 | 37 | | |||
38 | Q_PROPERTY(bool busy READ busy NOTIFY busyChanged) | ||||
38 | Q_PROPERTY(bool hasPreview READ hasPreview NOTIFY pixmapChanged) | 39 | Q_PROPERTY(bool hasPreview READ hasPreview NOTIFY pixmapChanged) | ||
39 | Q_PROPERTY(QPixmap pixmap READ pixmap NOTIFY pixmapChanged) | 40 | Q_PROPERTY(QPixmap pixmap READ pixmap NOTIFY pixmapChanged) | ||
40 | Q_PROPERTY(QSize pixmapSize READ pixmapSize NOTIFY pixmapChanged) | 41 | Q_PROPERTY(QSize pixmapSize READ pixmapSize NOTIFY pixmapChanged) | ||
41 | 42 | | |||
42 | Q_PROPERTY(QString iconName READ iconName NOTIFY iconNameChanged) | 43 | Q_PROPERTY(QString iconName READ iconName NOTIFY iconNameChanged) | ||
43 | 44 | | |||
44 | Q_PROPERTY(bool menuVisible READ menuVisible NOTIFY menuVisibleChanged) | 45 | Q_PROPERTY(bool menuVisible READ menuVisible NOTIFY menuVisibleChanged) | ||
45 | 46 | | |||
46 | public: | 47 | public: | ||
47 | explicit Thumbnailer(QObject *parent = nullptr); | 48 | explicit Thumbnailer(QObject *parent = nullptr); | ||
48 | ~Thumbnailer() override; | 49 | ~Thumbnailer() override; | ||
49 | 50 | | |||
50 | QUrl url() const; | 51 | QUrl url() const; | ||
51 | void setUrl(const QUrl &url); | 52 | void setUrl(const QUrl &url); | ||
52 | 53 | | |||
53 | QSize size() const; | 54 | QSize size() const; | ||
54 | void setSize(const QSize &size); | 55 | void setSize(const QSize &size); | ||
55 | 56 | | |||
57 | bool busy() const; | ||||
56 | bool hasPreview() const; | 58 | bool hasPreview() const; | ||
57 | QPixmap pixmap() const; | 59 | QPixmap pixmap() const; | ||
58 | QSize pixmapSize() const; | 60 | QSize pixmapSize() const; | ||
59 | 61 | | |||
60 | QString iconName() const; | 62 | QString iconName() const; | ||
61 | 63 | | |||
62 | bool menuVisible() const; | 64 | bool menuVisible() const; | ||
63 | 65 | | |||
64 | Q_INVOKABLE void showContextMenu(int x, int y, const QString &path, QQuickItem *ctx); | | |||
65 | | ||||
66 | void classBegin() override; | 66 | void classBegin() override; | ||
67 | void componentComplete() override; | 67 | void componentComplete() override; | ||
68 | 68 | | |||
69 | signals: | 69 | signals: | ||
70 | void menuVisibleChanged(); | 70 | void menuVisibleChanged(); | ||
71 | 71 | | |||
72 | void urlChanged(); | 72 | void urlChanged(); | ||
73 | void sizeChanged(); | 73 | void sizeChanged(); | ||
74 | void busyChanged(); | ||||
74 | void pixmapChanged(); | 75 | void pixmapChanged(); | ||
75 | void iconNameChanged(); | 76 | void iconNameChanged(); | ||
76 | 77 | | |||
77 | private: | 78 | private: | ||
78 | void generatePreview(); | 79 | void generatePreview(); | ||
79 | 80 | | |||
80 | bool m_inited = false; | 81 | bool m_inited = false; | ||
81 | 82 | | |||
82 | bool m_menuVisible = false; | 83 | bool m_menuVisible = false; | ||
83 | 84 | | |||
84 | QUrl m_url; | 85 | QUrl m_url; | ||
85 | QSize m_size; | 86 | QSize m_size; | ||
86 | 87 | | |||
88 | bool m_busy = false; | ||||
89 | | ||||
87 | QPixmap m_pixmap; | 90 | QPixmap m_pixmap; | ||
88 | 91 | | |||
89 | QString m_iconName; | 92 | QString m_iconName; | ||
90 | 93 | | |||
91 | }; | 94 | }; |