From f14878b05ee885f1747feab256011b4da72ae778 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 23 Aug 2019 15:36:18 +0800 Subject: Started to use cURL --- kelakon.pro | 11 ++++++++++- main.cxx | 10 ++++++++++ networkworker.cxx | 16 ++++++++++++++++ networkworker.hxx | 17 +++++++++++++++++ rtclient.c | 33 +++++++++++++++++++++++++++++++++ rtclient.h | 15 +++++++++++++++ 6 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 networkworker.cxx create mode 100644 networkworker.hxx create mode 100644 rtclient.c create mode 100644 rtclient.h diff --git a/kelakon.pro b/kelakon.pro index fb0d403..e0e0d89 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -1,6 +1,15 @@ QT += quickcontrols2 +HEADERS += \ + rtclient.h \ + networkworker.hxx + SOURCES += \ - main.cxx + rtclient.c \ + networkworker.cxx \ + main.cxx RESOURCES += kelakon.qrc + +LIBS += \ + -lcurl diff --git a/main.cxx b/main.cxx index 94f8599..0108135 100644 --- a/main.cxx +++ b/main.cxx @@ -1,11 +1,21 @@ #include #include +#include +#include "networkworker.hxx" int main(int argc, char* argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; + + Kelakon::NetworkWorker worker{}; + QThread thread; + worker.moveToThread(&thread); + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + thread.start(); + return app.exec(); } diff --git a/networkworker.cxx b/networkworker.cxx new file mode 100644 index 0000000..928e4e8 --- /dev/null +++ b/networkworker.cxx @@ -0,0 +1,16 @@ +#include "rtclient.h" +#include "networkworker.hxx" + +namespace Kelakon { + + 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..c08743f --- /dev/null +++ b/networkworker.hxx @@ -0,0 +1,17 @@ +#ifndef NETWORKWORKER_HXX +#define NETWORKWORKER_HXX + +#include + +namespace Kelakon { + + class NetworkWorker : public QObject + { + Q_OBJECT + public: + explicit NetworkWorker(QObject* parent = Q_NULLPTR); + virtual ~NetworkWorker(); + }; +} + +#endif // NETWORKWORKER_HXX diff --git a/rtclient.c b/rtclient.c new file mode 100644 index 0000000..1be0579 --- /dev/null +++ b/rtclient.c @@ -0,0 +1,33 @@ +#ifdef DEBUG +#ifdef ANDROID +#include +#else +#include +#endif // ANDROID +#endif // DEBUG +#include +#include +#include "rtclient.h" + +static CURL *handle = NULL; + +bool rtclient_init() +{ + curl_global_init(CURL_GLOBAL_SSL); + handle = curl_easy_init(); + if (handle) { + curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L); +#ifdef DEBUG + curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); +#endif + } + + return (bool)handle; +} + +void rtclient_cleanup() +{ + if (handle) + curl_easy_cleanup(handle); + curl_global_cleanup(); +} diff --git a/rtclient.h b/rtclient.h new file mode 100644 index 0000000..53b8a51 --- /dev/null +++ b/rtclient.h @@ -0,0 +1,15 @@ +#ifndef RTCLIENT_H +#define RTCLIENT_H + +#ifdef __cplusplus +extern "C" { +#endif + + bool rtclient_init(); + void rtclient_cleanup(); + +#ifdef __cplusplus +} +#endif + +#endif // RTCLIENT_H -- cgit v1.2.3 From 356fa9d29a53aa0dba28016b932f8042f8d3970a Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Fri, 23 Aug 2019 17:47:20 +0800 Subject: Started using cURL on Android There's a quirk since Clang. It seems the Android search path setting messes up the standard library compilation. So for now, what you do is remove the android-* setting to make Qt compile, even though it would say it cannot find libcurl, and then put the setting back again to link with libcurl. --- kelakon.pro | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kelakon.pro b/kelakon.pro index e0e0d89..8f1240f 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -11,5 +11,12 @@ SOURCES += \ RESOURCES += kelakon.qrc +android-* { + INCLUDEPATH += $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/include + LIBS += -L$$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib + ANDROID_EXTRA_LIBS += \ + $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libcurl.so +} + LIBS += \ -lcurl -- cgit v1.2.3 From 06eb4d8c7992def13ad5ca70baba3acda2f35a06 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sat, 24 Aug 2019 14:56:01 +0800 Subject: Simplified qmake syntax --- kelakon.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kelakon.pro b/kelakon.pro index 8f1240f..ab6c01c 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -11,7 +11,7 @@ SOURCES += \ RESOURCES += kelakon.qrc -android-* { +android { INCLUDEPATH += $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/include LIBS += -L$$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib ANDROID_EXTRA_LIBS += \ -- cgit v1.2.3 From 393bb95e97f8e53c430fb95926128ad2b683af63 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sat, 24 Aug 2019 18:20:29 +0800 Subject: On Android, include OpenSSL libs --- kelakon.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kelakon.pro b/kelakon.pro index ab6c01c..3ae1497 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -15,6 +15,8 @@ android { INCLUDEPATH += $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/include LIBS += -L$$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib ANDROID_EXTRA_LIBS += \ + $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libcrypto.so \ + $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libssl.so \ $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libcurl.so } -- cgit v1.2.3 From c4d1459599fc312ca4bdd5300d3f00ba24bd2af3 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sat, 24 Aug 2019 21:31:42 +0800 Subject: Made specific Android settings apply on Qt Creator By using the "contains" function, and also just hardcode the toolchain path. --- kelakon.pro | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kelakon.pro b/kelakon.pro index 3ae1497..35bc0a9 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -11,13 +11,13 @@ SOURCES += \ RESOURCES += kelakon.qrc -android { - INCLUDEPATH += $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/include - LIBS += -L$$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib +contains(ANDROID_TARGET_ARCH,armeabi-v7a) { + INCLUDEPATH += /usr/local/arm-linux-androideabi/sysroot/usr/include + LIBS += -L/usr/local/arm-linux-androideabi/sysroot/usr/lib ANDROID_EXTRA_LIBS += \ - $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libcrypto.so \ - $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libssl.so \ - $$(ANDROID_STANDALONE_TOOLCHAIN)/usr/lib/libcurl.so + /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 } LIBS += \ -- cgit v1.2.3 From c3abee20a084b3669d648077086105672cee6564 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sun, 25 Aug 2019 09:59:11 +0800 Subject: Managed to differentiate C from C++ compilation --- kelakon.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kelakon.pro b/kelakon.pro index 35bc0a9..0892052 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -12,7 +12,7 @@ SOURCES += \ RESOURCES += kelakon.qrc contains(ANDROID_TARGET_ARCH,armeabi-v7a) { - INCLUDEPATH += /usr/local/arm-linux-androideabi/sysroot/usr/include + 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 \ -- cgit v1.2.3 From 6be07cabf768c5bdc11c14a750281e1c7b8b62ec Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sun, 25 Aug 2019 10:51:06 +0800 Subject: ARM64 Android settings for cURL --- kelakon.pro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kelakon.pro b/kelakon.pro index 0892052..61a0b3a 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -11,6 +11,15 @@ SOURCES += \ RESOURCES += kelakon.qrc +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 -- cgit v1.2.3 From b9bc9d9e391e6567a12182b9f6de355be1f5be1c Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sun, 25 Aug 2019 14:10:59 +0800 Subject: Reordered --- kelakon.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kelakon.pro b/kelakon.pro index 61a0b3a..c02a1b7 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -11,6 +11,9 @@ SOURCES += \ RESOURCES += kelakon.qrc +LIBS += \ + -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 @@ -28,6 +31,3 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) { /usr/local/arm-linux-androideabi/sysroot/usr/lib/libssl.so \ /usr/local/arm-linux-androideabi/sysroot/usr/lib/libcurl.so } - -LIBS += \ - -lcurl -- cgit v1.2.3 From c47e2b615be10861262752742d7aa5b306195d10 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Sun, 25 Aug 2019 17:48:25 +0800 Subject: Capitalised Android app label --- android/AndroidManifest.xml | 95 +++++++++++++++++++++++++++++++++++++++++++++ kelakon.pro | 4 ++ 2 files changed, 99 insertions(+) create mode 100644 android/AndroidManifest.xml diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 0000000..37a543f --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kelakon.pro b/kelakon.pro index c02a1b7..c91ba3e 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -31,3 +31,7 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) { /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 +} -- cgit v1.2.3 From afdab77790e8db165b43e9ab34cb26313b067856 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 08:28:24 +0800 Subject: Added rtclient module --- .gitmodules | 3 +++ kelakon.pro | 5 +++-- rtclient | 1 + rtclient.c | 33 --------------------------------- rtclient.h | 15 --------------- 5 files changed, 7 insertions(+), 50 deletions(-) create mode 100644 .gitmodules create mode 160000 rtclient delete mode 100644 rtclient.c delete mode 100644 rtclient.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ca6a061 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "rtclient"] + path = rtclient + url = ssh://darapsa.co.id/usr/local/git/rtclient.git diff --git a/kelakon.pro b/kelakon.pro index c91ba3e..db85290 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -1,17 +1,18 @@ QT += quickcontrols2 HEADERS += \ - rtclient.h \ networkworker.hxx SOURCES += \ - rtclient.c \ networkworker.cxx \ main.cxx RESOURCES += kelakon.qrc +INCLUDEPATH += $$PWD/rtclient + LIBS += \ + $$PWD/rtclient/librtclient.a \ -lcurl contains(ANDROID_TARGET_ARCH,arm64-v8a) { diff --git a/rtclient b/rtclient new file mode 160000 index 0000000..647a634 --- /dev/null +++ b/rtclient @@ -0,0 +1 @@ +Subproject commit 647a634d99c37d512cb4589c129985626786e9bd diff --git a/rtclient.c b/rtclient.c deleted file mode 100644 index 1be0579..0000000 --- a/rtclient.c +++ /dev/null @@ -1,33 +0,0 @@ -#ifdef DEBUG -#ifdef ANDROID -#include -#else -#include -#endif // ANDROID -#endif // DEBUG -#include -#include -#include "rtclient.h" - -static CURL *handle = NULL; - -bool rtclient_init() -{ - curl_global_init(CURL_GLOBAL_SSL); - handle = curl_easy_init(); - if (handle) { - curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L); -#ifdef DEBUG - curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L); -#endif - } - - return (bool)handle; -} - -void rtclient_cleanup() -{ - if (handle) - curl_easy_cleanup(handle); - curl_global_cleanup(); -} diff --git a/rtclient.h b/rtclient.h deleted file mode 100644 index 53b8a51..0000000 --- a/rtclient.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef RTCLIENT_H -#define RTCLIENT_H - -#ifdef __cplusplus -extern "C" { -#endif - - bool rtclient_init(); - void rtclient_cleanup(); - -#ifdef __cplusplus -} -#endif - -#endif // RTCLIENT_H -- cgit v1.2.3 From 0ede7b58b82b0f75369a42fa90c2d8d1f36ad763 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 09:39:14 +0800 Subject: User class Qt wrapper on rt_user, plus the loggedIn attribute. --- user.cxx | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ user.hxx | 118 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+) create mode 100644 user.cxx create mode 100644 user.hxx diff --git a/user.cxx b/user.cxx new file mode 100644 index 0000000..0983874 --- /dev/null +++ b/user.cxx @@ -0,0 +1,187 @@ +#include "rtuser.h" +#include "user.hxx" + +void User::update(rt_user* user) +{ + if (m_isLoggedIn) { + setName(QString{user->name}); + setEmailAddress(QString{user->emailaddress}); + setOrganization(QString{user->organization}); + setRealName(QString{user->realname}); + setNickName(QString{user->nickname}); + setLang(QString{user->lang}); + setHomePhone(QString{user->homephone}); + setWorkPhone(QString{user->workphone}); + setMobilePhone(QString{user->mobilephone}); + setPagerPhone(QString{user->pagerphone}); + setAddress1(QString{user->address1}); + setAddress2(QString{user->address2}); + setCity(QString{user->city}); + setState(QString{user->state}); + setZip(QString{user->zip}); + setCountry(QString{user->country}); + setTimeZone(QString{user->timezone}); + } else { + setName(""); + setEmailAddress(""); + setOrganization(""); + setRealName(""); + setNickName(""); + setLang(""); + setHomePhone(""); + setWorkPhone(""); + setMobilePhone(""); + setPagerPhone(""); + setAddress1(""); + setAddress2(""); + setCity(""); + setState(""); + setZip(""); + setCountry(""); + setTimeZone(""); + } +} + +void User::setName(QString const& name) +{ + if (m_name != name) { + m_name = name; + emit nameChanged(); + } +} + +void User::setEmailAddress(QString const& emailAddress) +{ + if (m_emailAddress != emailAddress) { + m_emailAddress = emailAddress; + emit emailAddressChanged(); + } +} + +void User::setOrganization(QString const& organization) +{ + if (m_organization != organization) { + m_organization = organization; + emit organizationChanged(); + } +} + +void User::setRealName(QString const& realName) +{ + if (m_realName != realName) { + m_realName = realName; + emit realNameChanged(); + } +} + +void User::setNickName(QString const& nickName) +{ + if (m_nickName != nickName) { + m_nickName = nickName; + emit nickNameChanged(); + } +} + +void User::setLang(QString const& lang) +{ + if (m_lang != lang) { + m_lang = lang; + emit langChanged(); + } +} + +void User::setHomePhone(QString const& homePhone) +{ + if (m_homePhone != homePhone) { + m_homePhone = homePhone; + emit homePhoneChanged(); + } +} + +void User::setWorkPhone(QString const& workPhone) +{ + if (m_workPhone != workPhone) { + m_workPhone = workPhone; + emit workPhoneChanged(); + } +} + +void User::setMobilePhone(QString const& mobilePhone) +{ + if (m_mobilePhone != mobilePhone) { + m_mobilePhone = mobilePhone; + emit mobilePhoneChanged(); + } +} + +void User::setPagerPhone(QString const& pagerPhone) +{ + if (m_pagerPhone != pagerPhone) { + m_pagerPhone = pagerPhone; + emit pagerPhoneChanged(); + } +} + +void User::setAddress1(QString const& address1) +{ + if (m_address1 != address1) { + m_address1 = address1; + emit address1Changed(); + } +} + +void User::setAddress2(QString const& address2) +{ + if (m_address2 != address2) { + m_address2 = address2; + emit address2Changed(); + } +} + +void User::setCity(QString const& city) +{ + if (m_city != city) { + m_city = city; + emit cityChanged(); + } +} + +void User::setState(QString const& state) +{ + if (m_state != state) { + m_state = state; + emit stateChanged(); + } +} + +void User::setZip(QString const& zip) +{ + if (m_zip != zip) { + m_zip = zip; + emit zipChanged(); + } +} + +void User::setCountry(QString const& country) +{ + if (m_country != country) { + m_country = country; + emit countryChanged(); + } +} + +void User::setTimeZone(QString const& timeZone) +{ + if (m_timeZone != timeZone) { + m_timeZone = timeZone; + emit timeZoneChanged(); + } +} + +void User::setLoggedIn(bool isLoggedIn) +{ + if (m_isLoggedIn != isLoggedIn) { + m_isLoggedIn = isLoggedIn; + emit loggedInChanged(); + } +} diff --git a/user.hxx b/user.hxx new file mode 100644 index 0000000..1cac5fe --- /dev/null +++ b/user.hxx @@ -0,0 +1,118 @@ +#ifndef USER_HXX +#define USER_HXX + +#include + +struct rt_user; + +class User : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString emailAddress READ emailAddress WRITE setEmailAddress NOTIFY emailAddressChanged) + Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged) + Q_PROPERTY(QString realName READ realName WRITE setRealName NOTIFY realNameChanged) + Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged) + Q_PROPERTY(QString lang READ lang WRITE setLang NOTIFY langChanged) + Q_PROPERTY(QString homePhone READ homePhone WRITE setHomePhone NOTIFY homePhoneChanged) + Q_PROPERTY(QString workPhone READ workPhone WRITE setWorkPhone NOTIFY workPhoneChanged) + Q_PROPERTY(QString mobilePhone READ mobilePhone WRITE setMobilePhone NOTIFY mobilePhoneChanged) + Q_PROPERTY(QString pagerPhone READ pagerPhone WRITE setPagerPhone NOTIFY pagerPhoneChanged) + Q_PROPERTY(QString address1 READ address1 WRITE setAddress1 NOTIFY address1Changed) + Q_PROPERTY(QString address2 READ address2 WRITE setAddress2 NOTIFY address2Changed) + Q_PROPERTY(QString city READ city WRITE setCity NOTIFY cityChanged) + Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) + Q_PROPERTY(QString zip READ zip WRITE setZip NOTIFY zipChanged) + Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged) + Q_PROPERTY(QString timeZone READ timeZone WRITE setTimeZone NOTIFY timeZoneChanged) + Q_PROPERTY(bool isLoggedIn READ isLoggedIn WRITE setLoggedIn NOTIFY loggedInChanged) + + public: + explicit User(bool isLoggedIn = false, QObject* parent = nullptr) : + QObject{parent}, + m_isLoggedIn{isLoggedIn} + {} + ~User() {} + + Q_INVOKABLE void update(rt_user* user); + + QString const& name() const { return m_name; } + QString const& emailAddress() const { return m_emailAddress; } + QString const& organization() const { return m_organization; } + QString const& realName() const { return m_realName; } + QString const& nickName() const { return m_nickName; } + QString const& lang() const { return m_lang; } + QString const& homePhone() const { return m_homePhone; } + QString const& workPhone() const { return m_workPhone; } + QString const& mobilePhone() const { return m_mobilePhone; } + QString const& pagerPhone() const { return m_pagerPhone; } + QString const& address1() const { return m_address1; } + QString const& address2() const { return m_address2; } + QString const& city() const { return m_city; } + QString const& state() const { return m_state; } + QString const& zip() const { return m_zip; } + QString const& country() const { return m_country; } + QString const& timeZone() const { return m_timeZone; } + bool isLoggedIn() const { return m_isLoggedIn; } + + void setName(QString const& name); + void setEmailAddress(QString const& emailAddress); + void setOrganization(QString const& organization); + void setRealName(QString const& realName); + void setNickName(QString const& nickName); + void setLang(QString const& lang); + void setHomePhone(QString const& homePhone); + void setWorkPhone(QString const& workPhone); + void setMobilePhone(QString const& mobilePhone); + void setPagerPhone(QString const& pagerPhone); + void setAddress1(QString const& address1); + void setAddress2(QString const& address2); + void setCity(QString const& city); + void setState(QString const& state); + void setZip(QString const& zip); + void setCountry(QString const& country); + void setTimeZone(QString const& timeZone); + void setLoggedIn(bool isLoggedIn); + + signals: + void nameChanged(); + void emailAddressChanged(); + void organizationChanged(); + void realNameChanged(); + void nickNameChanged(); + void langChanged(); + void homePhoneChanged(); + void workPhoneChanged(); + void mobilePhoneChanged(); + void pagerPhoneChanged(); + void address1Changed(); + void address2Changed(); + void cityChanged(); + void stateChanged(); + void zipChanged(); + void countryChanged(); + void timeZoneChanged(); + void loggedInChanged(); + + private: + QString m_name; + QString m_emailAddress; + QString m_organization; + QString m_realName; + QString m_nickName; + QString m_lang; + QString m_homePhone; + QString m_workPhone; + QString m_mobilePhone; + QString m_pagerPhone; + QString m_address1; + QString m_address2; + QString m_city; + QString m_state; + QString m_zip; + QString m_country; + QString m_timeZone; + bool m_isLoggedIn; +}; + +#endif // USER_HXX -- cgit v1.2.3 From 40db7eb6ec8115342410b45a94f842d06bf63d91 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 09:41:35 +0800 Subject: Added the user class to the qmake project --- kelakon.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kelakon.pro b/kelakon.pro index db85290..12dc52d 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -1,10 +1,12 @@ QT += quickcontrols2 HEADERS += \ - networkworker.hxx + networkworker.hxx \ + user.hxx SOURCES += \ networkworker.cxx \ + user.cxx \ main.cxx RESOURCES += kelakon.qrc -- cgit v1.2.3 From 89860a73d0a65bd47a28002dbad6087292b2615d Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 09:54:38 +0800 Subject: Removed Kelakon namespace for NetworkWorker --- main.cxx | 2 +- networkworker.cxx | 19 ++++++++----------- networkworker.hxx | 17 +++++++---------- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/main.cxx b/main.cxx index 0108135..41b25af 100644 --- a/main.cxx +++ b/main.cxx @@ -9,7 +9,7 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); QQmlApplicationEngine engine; - Kelakon::NetworkWorker worker{}; + NetworkWorker worker{}; QThread thread; worker.moveToThread(&thread); diff --git a/networkworker.cxx b/networkworker.cxx index 928e4e8..3487d4c 100644 --- a/networkworker.cxx +++ b/networkworker.cxx @@ -1,16 +1,13 @@ #include "rtclient.h" #include "networkworker.hxx" -namespace Kelakon { - - NetworkWorker::NetworkWorker(QObject* parent) - : QObject{parent} - { - rtclient_init(); - } +NetworkWorker::NetworkWorker(QObject* parent) : + QObject{parent} +{ + rtclient_init(); +} - NetworkWorker::~NetworkWorker() - { - rtclient_cleanup(); - } +NetworkWorker::~NetworkWorker() +{ + rtclient_cleanup(); } diff --git a/networkworker.hxx b/networkworker.hxx index c08743f..05124d5 100644 --- a/networkworker.hxx +++ b/networkworker.hxx @@ -3,15 +3,12 @@ #include -namespace Kelakon { - - class NetworkWorker : public QObject - { - Q_OBJECT - public: - explicit NetworkWorker(QObject* parent = Q_NULLPTR); - virtual ~NetworkWorker(); - }; -} +class NetworkWorker : public QObject +{ + Q_OBJECT + public: + explicit NetworkWorker(QObject* parent = nullptr); + virtual ~NetworkWorker(); +}; #endif // NETWORKWORKER_HXX -- cgit v1.2.3 From 162a813b79208a0b678a9d5e9f3a5428efcb89eb Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 10:34:06 +0800 Subject: Updated rtclient --- rtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtclient b/rtclient index 647a634..dd3d7c5 160000 --- a/rtclient +++ b/rtclient @@ -1 +1 @@ -Subproject commit 647a634d99c37d512cb4589c129985626786e9bd +Subproject commit dd3d7c5b75f69b93c50928d533b002a6fb769897 -- cgit v1.2.3 From f743b9e09b110c0be7d342994c535184386a722e Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 10:42:12 +0800 Subject: Updated rtclient --- rtclient | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtclient b/rtclient index dd3d7c5..ecafe3a 160000 --- a/rtclient +++ b/rtclient @@ -1 +1 @@ -Subproject commit dd3d7c5b75f69b93c50928d533b002a6fb769897 +Subproject commit ecafe3ac8ea1d71ceaf0fd2161fc6fe599596f4e -- cgit v1.2.3 From 66ae26cf69793e89c95b73f0488a3da4fb7394c7 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Tue, 27 Aug 2019 10:55:54 +0800 Subject: Revert "Reindented and removed implicit code" This reverts commit 0791cac4bc4bd9fd6224f82efcdf07e9973a679d. --- Login.qml | 3 +++ main.qml | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 9 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/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 {} + } + } -- cgit v1.2.3