diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-24 23:11:05 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-24 23:11:05 +0800 |
commit | e20e3a90e66832809c3b78fd17d19a0008d82378 (patch) | |
tree | ac03dba8eedee6ef3a6ad2093391ace8892a14cd |
A Qt Core based library that depends on libicclient
and can be used for a Qt based project
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | client.cxx | 30 | ||||
m--------- | libicclient | 6 | ||||
-rw-r--r-- | qicclient.pro | 24 | ||||
-rw-r--r-- | qicclient/client.hxx | 27 |
6 files changed, 98 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e40417 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.a +*.pro.user +*.o +*.qmake.stash +*.so* +*.swp +Makefile +moc_* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9ee27ff --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libicclient"] + path = libicclient + url = git@github.com:darapsa/libicclient.git diff --git a/client.cxx b/client.cxx new file mode 100644 index 0000000..6cf6114 --- /dev/null +++ b/client.cxx @@ -0,0 +1,30 @@ +#include <icclient/client.h> +#include "qicclient/client.hxx" + +namespace ICClient { + + Client::Client(char const* url, char const* certificate) + { + icclient_init(url, certificate); + } + + Client::~Client() + { + icclient_cleanup(); + } + + void Client::logIn(QString const& username, QString const& password) + { + icclient_login(username.toLatin1().constData() + , password.toLatin1().constData(), NULL, NULL + , NULL); + emit loggedIn(username); + } + + void Client::logOut() + { + icclient_logout(); + emit loggedOut(); + } + +} diff --git a/libicclient b/libicclient new file mode 160000 +Subproject 57bb4f20c1cf737b49eac2a8be108a9ffbde60c diff --git a/qicclient.pro b/qicclient.pro new file mode 100644 index 0000000..40b180a --- /dev/null +++ b/qicclient.pro @@ -0,0 +1,24 @@ +QT -= gui +TEMPLATE = lib +CONFIG += staticlib + +HEADERS += \ + qicclient/client.hxx +SOURCES += \ + client.cxx +INCLUDEPATH += $$PWD/libicclient +LIBS += \ + $$PWD/libicclient/libicclient.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 +} + +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 +} + +debug: DEFINES += DEBUG diff --git a/qicclient/client.hxx b/qicclient/client.hxx new file mode 100644 index 0000000..aac8fb6 --- /dev/null +++ b/qicclient/client.hxx @@ -0,0 +1,27 @@ +#ifndef QRTCLIENT_CLIENT_HXX +#define QRTCLIENT_CLIENT_HXX + +#include <QObject> + +namespace ICClient { + + class Client : public QObject + { + Q_OBJECT + + public: + Client(char const* url, char const* certificate = NULL); + ~Client(); + + public slots: + void logIn(QString const& username, QString const& password); + void logOut(); + + signals: + void loggedIn(QString const& username); + void loggedOut(); + }; + +} + +#endif // QRTCLIENT_CLIENT_HXX |