From e20e3a90e66832809c3b78fd17d19a0008d82378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 24 Sep 2019 23:11:05 +0800 Subject: A Qt Core based library that depends on libicclient and can be used for a Qt based project --- .gitignore | 8 ++++++++ .gitmodules | 3 +++ client.cxx | 30 ++++++++++++++++++++++++++++++ libicclient | 1 + qicclient.pro | 24 ++++++++++++++++++++++++ qicclient/client.hxx | 27 +++++++++++++++++++++++++++ 6 files changed, 93 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 client.cxx create mode 160000 libicclient create mode 100644 qicclient.pro create mode 100644 qicclient/client.hxx 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 +#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 index 0000000..57bb4f2 --- /dev/null +++ b/libicclient @@ -0,0 +1 @@ +Subproject commit 57bb4f20c1cf737b49eac2a8be108a9ffbde60ce 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 + +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 -- cgit v1.2.3