-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathviewer.cpp
138 lines (111 loc) · 3.52 KB
/
viewer.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include <QQuickView>
#include <QString>
#include <QUrl>
#include <QWindow>
#include <QIcon>
#include <QQmlEngine>
#include <QMetaObject>
#include "viewer.h"
class QamelView : public QQuickView {
Q_OBJECT
public:
QamelView(QWindow *parent = 0) : QQuickView(parent) {}
QamelView(const QUrl &source, QWindow *parent = nullptr) : QQuickView(source, parent) {}
public slots:
void reload() {
engine()->clearComponentCache();
setSource(source());
}
};
void* Viewer_NewViewer() {
return new QamelView();
}
void Viewer_SetSource(void* ptr, char* url) {
QamelView *view = static_cast<QamelView*>(ptr);
QMetaObject::invokeMethod(view, "setSource", Q_ARG(QUrl, QUrl(QString(url))));
}
void Viewer_SetResizeMode(void* ptr, int resizeMode) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setResizeMode(QQuickView::ResizeMode(resizeMode));
}
void Viewer_SetFlags(void* ptr, int flags) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setFlags(Qt::WindowFlags(flags));
}
void Viewer_SetHeight(void* ptr, int height) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setHeight(height);
}
void Viewer_SetWidth(void* ptr, int width) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setWidth(width);
}
void Viewer_SetMaximumHeight(void* ptr, int height) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setMaximumHeight(height);
}
void Viewer_SetMaximumWidth(void* ptr, int width) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setMaximumWidth(width);
}
void Viewer_SetMinimumHeight(void* ptr, int height) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setMinimumHeight(height);
}
void Viewer_SetMinimumWidth(void* ptr, int width) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setMinimumWidth(width);
}
void Viewer_SetOpacity(void* ptr, double opacity) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setOpacity(opacity);
}
void Viewer_SetTitle(void* ptr, char* title) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setTitle(QString(title));
}
void Viewer_SetVisible(void* ptr, bool visible) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setVisible(visible);
}
void Viewer_SetPosition(void* ptr, int x, int y) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setPosition(x, y);
}
void Viewer_SetIcon(void* ptr, char* fileName) {
QamelView *view = static_cast<QamelView*>(ptr);
QIcon icon = QIcon(QString(fileName));
view->setIcon(icon);
}
void Viewer_Show(void* ptr) {
QamelView *view = static_cast<QamelView*>(ptr);
view->show();
}
void Viewer_ShowMaximized(void* ptr) {
QamelView *view = static_cast<QamelView*>(ptr);
view->showMaximized();
}
void Viewer_ShowMinimized(void* ptr) {
QamelView *view = static_cast<QamelView*>(ptr);
view->showMinimized();
}
void Viewer_ShowFullScreen(void* ptr) {
QamelView *view = static_cast<QamelView*>(ptr);
view->showFullScreen();
}
void Viewer_ShowNormal(void* ptr) {
QamelView *view = static_cast<QamelView*>(ptr);
view->showNormal();
}
void Viewer_SetWindowStates(void* ptr, int state) {
QamelView *view = static_cast<QamelView*>(ptr);
view->setWindowStates(Qt::WindowStates(state));
}
void Viewer_ClearComponentCache(void* ptr) {
QamelView *view = static_cast<QamelView*>(ptr);
view->engine()->clearComponentCache();
}
void Viewer_Reload(void* ptr) {
QMetaObject::invokeMethod(static_cast<QamelView*>(ptr), "reload");
}
#include "moc-viewer.h"