forked from ddvk/remarkable-touchgestures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.cpp
42 lines (37 loc) · 1.08 KB
/
ui.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
#include <QGuiApplication>
#include <QPainter>
#include <QImage>
#include "ui.h"
#include "config.h"
#ifdef REMARKABLE
#include <epframebuffer.h>
//segfault if it does not exist
static QGuiApplication *app=nullptr;
#endif
extern "C" {
void ui_init(){
#ifdef REMARKABLE
qputenv("QMLSCENE_DEVICE", "epaper");
qputenv("QT_QPA_PLATFORM", "epaper:enable_fonts");
qputenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS", "rotate=180");
qputenv("QT_QPA_GENERIC_PLUGINS", "evdevtablet");
char *argv [0];
int argc = 0;
app = new QGuiApplication(argc,argv);
#endif
}
void show(const char *str){
#ifdef REMARKABLE
QPainter painter(EPFrameBuffer::framebuffer());
int x = SCREEN_WIDTH / 3;
int y = SCREEN_HEIGHT - 20;
QRect rect(x - 50,y - 50, 600, 100);
painter.eraseRect(rect);
painter.drawText(x,y, str);
painter.end();
EPFrameBuffer::sendUpdate(rect, EPFrameBuffer::Grayscale, EPFrameBuffer::PartialUpdate);
#else
printf("show: %s\n", str);
#endif
}
}