summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Prabowo Kamal <erik@darapsa.co.id>2019-08-27 10:57:41 +0800
committerErik Prabowo Kamal <erik@darapsa.co.id>2019-08-27 10:57:41 +0800
commiteab46365359fb1846b16fa33cfe71593da05cb15 (patch)
tree5704395d2de63c67f2bba77e65cc40b1b4fa3017
parent0ced5545b7053ea6d77c0191e5732e36f7737467 (diff)
parent66ae26cf69793e89c95b73f0488a3da4fb7394c7 (diff)
Merge branch 'curl' into development
-rw-r--r--Login.qml3
-rw-r--r--kelakon.pro32
-rw-r--r--main.cxx10
-rw-r--r--main.qml22
-rw-r--r--networkworker.cxx13
-rw-r--r--networkworker.hxx14
6 files changed, 84 insertions, 10 deletions
diff --git a/Login.qml b/Login.qml
index d39c60d..1e450ce 100644
--- a/Login.qml
+++ b/Login.qml
@@ -1,6 +1,9 @@
import QtQuick 2.12
LoginForm {
+ width: appWindow.width
+ height: appWindow.height
+
emailButton {
onClicked: {
stackView.push("qrc:/pages/Email.qml")
diff --git a/kelakon.pro b/kelakon.pro
index cbd9221..12dc52d 100644
--- a/kelakon.pro
+++ b/kelakon.pro
@@ -1,10 +1,40 @@
QT += quickcontrols2
+HEADERS += \
+ networkworker.hxx \
+ user.hxx
+
SOURCES += \
- main.cxx
+ networkworker.cxx \
+ user.cxx \
+ main.cxx
RESOURCES += kelakon.qrc
+INCLUDEPATH += $$PWD/rtclient
+
+LIBS += \
+ $$PWD/rtclient/librtclient.a \
+ -lcurl
+
+contains(ANDROID_TARGET_ARCH,arm64-v8a) {
+ QMAKE_CFLAGS += -I/usr/local/aarch64-linux-android/sysroot/usr/include
+ LIBS += -L/usr/local/aarch64-linux-android/sysroot/usr/lib
+ ANDROID_EXTRA_LIBS += \
+ /usr/local/aarch64-linux-android/sysroot/usr/lib/libcrypto.so \
+ /usr/local/aarch64-linux-android/sysroot/usr/lib/libssl.so \
+ /usr/local/aarch64-linux-android/sysroot/usr/lib/libcurl.so
+}
+
+contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
+ QMAKE_CFLAGS += -I/usr/local/arm-linux-androideabi/sysroot/usr/include
+ LIBS += -L/usr/local/arm-linux-androideabi/sysroot/usr/lib
+ ANDROID_EXTRA_LIBS += \
+ /usr/local/arm-linux-androideabi/sysroot/usr/lib/libcrypto.so \
+ /usr/local/arm-linux-androideabi/sysroot/usr/lib/libssl.so \
+ /usr/local/arm-linux-androideabi/sysroot/usr/lib/libcurl.so
+}
+
android {
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
}
diff --git a/main.cxx b/main.cxx
index 94f8599..41b25af 100644
--- a/main.cxx
+++ b/main.cxx
@@ -1,11 +1,21 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
+#include <QThread>
+#include "networkworker.hxx"
int main(int argc, char* argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
+
+ NetworkWorker worker{};
+ QThread thread;
+ worker.moveToThread(&thread);
+
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ thread.start();
+
return app.exec();
}
diff --git a/main.qml b/main.qml
index e0ee73f..8fbb800 100644
--- a/main.qml
+++ b/main.qml
@@ -2,13 +2,17 @@ import QtQuick 2.12
import QtQuick.Controls 2.12
ApplicationWindow {
- id: appWindow
- width: 360
- height: 640
- visible: true
-
- StackView {
- id: stackView
- initialItem: Login {}
- }
+ id: appWindow
+ width: 362
+ height: 628
+ visible: true
+
+ StackView {
+ id: stackView
+ width: 362
+ height: 628
+
+ initialItem: Login {}
+ }
+
}
diff --git a/networkworker.cxx b/networkworker.cxx
new file mode 100644
index 0000000..3487d4c
--- /dev/null
+++ b/networkworker.cxx
@@ -0,0 +1,13 @@
+#include "rtclient.h"
+#include "networkworker.hxx"
+
+NetworkWorker::NetworkWorker(QObject* parent) :
+ QObject{parent}
+{
+ rtclient_init();
+}
+
+NetworkWorker::~NetworkWorker()
+{
+ rtclient_cleanup();
+}
diff --git a/networkworker.hxx b/networkworker.hxx
new file mode 100644
index 0000000..05124d5
--- /dev/null
+++ b/networkworker.hxx
@@ -0,0 +1,14 @@
+#ifndef NETWORKWORKER_HXX
+#define NETWORKWORKER_HXX
+
+#include <QObject>
+
+class NetworkWorker : public QObject
+{
+ Q_OBJECT
+ public:
+ explicit NetworkWorker(QObject* parent = nullptr);
+ virtual ~NetworkWorker();
+};
+
+#endif // NETWORKWORKER_HXX