├── qml.qrc
├── js
└── Main.js
├── mainview.h
├── readme.md
├── main.cpp
├── .gitignore
├── mainview.cpp
├── reHackable-launcher.pro
└── qml
└── Main.qml
/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/js/Main.js:
--------------------------------------------------------------------------------
1 | // Main.js
2 |
3 | function displayDateAsHHMMSS() {
4 | var d = new Date();
5 | var s = d.getSeconds ();
6 | var sep = s % 2 == 0 ? " " : ":";
7 | return (("0" + d.getHours()).slice(-2) + ":" +
8 | ("0" + d.getMinutes()).slice(-2) + sep +
9 | ("0" + s).slice(-2));
10 | }
11 |
--------------------------------------------------------------------------------
/mainview.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINVIEW_H
2 | #define MAINVIEW_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | class MainView : public QQuickView
9 | {
10 | public:
11 | MainView();
12 | public slots:
13 | void keyPressEvent(QKeyEvent*);
14 | void mouseMoveEvent(QMouseEvent* me);
15 | void mousePressEvent(QMouseEvent* me);
16 | void mouseReleaseEvent(QMouseEvent* me);
17 | void tabletEvent(QTabletEvent* te);
18 | void touchEvent(QTouchEvent* te);
19 | };
20 |
21 | #endif // MAINVIEW_H
22 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ## reHackable-HelloWorld
2 | This is actually a very first version of 'reHackable-launcher', which has the objective to offer an interface to launch other utilities/bash scripts from an interface appart from Xochitl.
3 |
4 | Built with QtCreator. I followed [this guide for the RPi](http://www.jumpnowtek.com/rpi/Qt-Creator-Setup-for-RPi-cross-development.html) to setup the [toolchain offered by reMarkable](https://remarkable.engineering/deploy/sdk/) in Qt Creator.
5 |
6 |
7 | Also checkout [dragly/hello-remarkable](https://github.com/dragly/hello-remarkable), another demo from a more experienced developer
8 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | //#include
3 | //#include
4 | #include "mainview.h"
5 |
6 | Q_IMPORT_PLUGIN(QsgEpaperPlugin)
7 |
8 | int main(int argc, char *argv[])
9 | {
10 | qputenv("QMLSCENE_DEVICE", "epaper");
11 | qputenv("QT_QPA_PLATFORM", "epaper:enable_fonts");
12 | qputenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS", "rotate=180");
13 | // qputenv("QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS", "/dev/input/event1");
14 | // qputenv("QT_QPA_EGLFS_NO_LIBINPUT", "1");
15 |
16 | QGuiApplication app(argc, argv);
17 | MainView view;
18 |
19 | view.rootContext()->setContextProperty("screenGeometry", app.primaryScreen()->geometry());
20 | view.engine()->addImportPath(QStringLiteral(DEPLOYMENT_PATH));
21 | view.setSource(QDir(DEPLOYMENT_PATH).filePath("qml/Main.qml"));
22 | view.show();
23 |
24 | qDebug() << "view shown";
25 | return app.exec();
26 | }
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 |
--------------------------------------------------------------------------------
/mainview.cpp:
--------------------------------------------------------------------------------
1 | #include "mainview.h"
2 |
3 | MainView::MainView()
4 | {
5 |
6 | }
7 |
8 | void MainView::keyPressEvent(QKeyEvent* ke)
9 | {
10 | qDebug() << Q_FUNC_INFO;
11 | qDebug() << "mw" << ke->key() << "down";
12 | QQuickView::keyPressEvent(ke); // base class implementation
13 | }
14 |
15 | void MainView::mouseMoveEvent(QMouseEvent* me)
16 | {
17 | qDebug() << Q_FUNC_INFO;
18 | qDebug() << me->pos();
19 | QQuickView::mouseMoveEvent(me);
20 | }
21 |
22 | void MainView::mousePressEvent(QMouseEvent* me)
23 | {
24 | qDebug() << Q_FUNC_INFO;
25 | qDebug() << me->pos();
26 | QQuickView::mousePressEvent(me);
27 | }
28 |
29 | void MainView::mouseReleaseEvent(QMouseEvent* me)
30 | {
31 | qDebug() << Q_FUNC_INFO;
32 | qDebug() << me->pos();
33 | QQuickView::mouseReleaseEvent(me);
34 | }
35 |
36 | void MainView::tabletEvent(QTabletEvent* te)
37 | {
38 | qDebug() << Q_FUNC_INFO;
39 | qDebug() << te;
40 | }
41 |
42 | void MainView::touchEvent(QTouchEvent* te)
43 | {
44 | qDebug() << Q_FUNC_INFO;
45 | qDebug() << te;
46 | }
47 |
--------------------------------------------------------------------------------
/reHackable-launcher.pro:
--------------------------------------------------------------------------------
1 | QT += quick
2 | CONFIG += c++11
3 | LIBS += -lqsgepaper
4 |
5 | TARGET = reHackable-launcher
6 |
7 | # The following define makes your compiler emit warnings if you use
8 | # any feature of Qt which as been marked deprecated (the exact warnings
9 | # depend on your compiler). Please consult the documentation of the
10 | # deprecated API in order to know how to port your code away from it.
11 | DEFINES += QT_DEPRECATED_WARNINGS
12 |
13 | # You can also make your code fail to compile if you use deprecated APIs.
14 | # In order to do so, uncomment the following line.
15 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
16 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17 |
18 | HEADERS += \
19 | mainview.h
20 |
21 | SOURCES += main.cpp \
22 | mainview.cpp
23 |
24 | DEPLOYMENT_PATH = /usr/share/$$TARGET
25 | DEFINES += DEPLOYMENT_PATH=\\\"$$DEPLOYMENT_PATH\\\"
26 | DEFINES += QML_FOLDER=\\\"qml\\\"
27 |
28 | js.files = js/Main.js
29 | js.path == $$DEPLOYMENT_PATH/js
30 | INSTALLS += js
31 |
32 | qml.files = qml/Main.qml
33 | qml.path == $$DEPLOYMENT_PATH/qml
34 | INSTALLS += qml
35 |
36 | # Additional import path used to resolve QML modules in Qt Creator's code model
37 | QML_IMPORT_PATH =
38 |
39 |
40 |
41 | target.path = /usr/bin
42 | INSTALLS += target
43 |
44 | DISTFILES += \
45 | js/Main.js
46 |
47 |
--------------------------------------------------------------------------------
/qml/Main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.0
2 | import "../js/Main.js" as MainJS
3 |
4 | Rectangle {
5 | id: canvas
6 | width: screenGeometry.width
7 | height: screenGeometry.height
8 |
9 | MouseArea {
10 | id: ma
11 | anchors.fill: parent
12 | hoverEnabled: true
13 |
14 | onClicked: {
15 | console.log("big: click detected");
16 | }
17 | }
18 | Rectangle {
19 | id: infoRect
20 | function toggleInfo() {
21 | infoRect.visible = !infoRect.visible;
22 | console.log("info set to " + infoRect.visible);
23 | // bad way to refresh the item
24 | clock.visible = false
25 | clock.visible = true
26 | }
27 | width: 800
28 | height: 500
29 | anchors.centerIn: parent
30 | border.width: 10
31 |
32 | Text {
33 | anchors {
34 | fill: parent
35 | margins: 5
36 | }
37 | id: info
38 | text: (
39 | "pos: ("
40 | + ma.mouseX.toFixed(2) + "," + ma.mouseY.toFixed(2) + ")"
41 | + "\n small Area is pressed: " + maSmall.pressed
42 | + "\n containsPress: " + ma.containsPress
43 | )
44 | }
45 | }
46 | Rectangle {
47 | id: clock
48 | width: 200
49 | height: 50
50 | y: screenGeometry.height- clock.height
51 | x: screenGeometry.width - clock.width
52 | color: !infoRect.visible ? "white" : "black"
53 | border.width: 2
54 | border.color: infoRect.visible ? "white" : "black"
55 |
56 |
57 | MouseArea {
58 | id: maSmall
59 | anchors.fill: parent
60 | hoverEnabled: true
61 | onClicked: console.log("small: click detected")
62 | onPressAndHold: {
63 | infoRect.toggleInfo();
64 | console.log("small: HOLD");
65 | }
66 | }
67 |
68 | Text {
69 | color: infoRect.visible ? "white" : "black"
70 | id: time
71 | anchors {
72 | left: parent.left
73 | leftMargin: 8
74 | }
75 | text: ""
76 | }
77 |
78 | Timer {
79 | interval: 500
80 | running: true
81 | repeat: true
82 | onTriggered: {
83 | time.text = MainJS.displayDateAsHHMMSS();
84 | }
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------