From 9f568d5ef6e1614638c2d32cd557e5cbef72f2bf Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 27 Nov 2018 19:15:54 +0100 Subject: [PATCH] Added login form --- ComunicMessages.pro | 14 +++++++++ config.h | 18 +++++++++++ helpers/accounthelper.cpp | 12 ++++++++ helpers/accounthelper.h | 30 +++++++++++++++++++ main.cpp | 22 ++++++++++++++ widgets/loginwidget.cpp | 14 +++++++++ widgets/loginwidget.h | 22 ++++++++++++++ widgets/loginwidget.ui | 63 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 195 insertions(+) create mode 100644 config.h create mode 100644 helpers/accounthelper.cpp create mode 100644 helpers/accounthelper.h create mode 100644 main.cpp create mode 100644 widgets/loginwidget.cpp create mode 100644 widgets/loginwidget.h create mode 100644 widgets/loginwidget.ui diff --git a/ComunicMessages.pro b/ComunicMessages.pro index e69de29..3271cfb 100644 --- a/ComunicMessages.pro +++ b/ComunicMessages.pro @@ -0,0 +1,14 @@ +QT += widgets + +SOURCES += \ + main.cpp \ + helpers/accounthelper.cpp \ + widgets/loginwidget.cpp + +HEADERS += \ + helpers/accounthelper.h \ + config.h \ + widgets/loginwidget.h + +FORMS += \ + widgets/loginwidget.ui diff --git a/config.h b/config.h new file mode 100644 index 0000000..5bb3e73 --- /dev/null +++ b/config.h @@ -0,0 +1,18 @@ +/** + * Project configuration + * + * @author Pierre HUBERT + */ +#ifndef CONFIG_H +#define CONFIG_H + +/** + * API credentials + */ +#define API_URL "https://api.communiquons.org/" +#define API_SERVICE_NAME "ComunicAndroid" +#define API_SERVICE_TOKEN "cWHlmMS5A1" + + + +#endif // CONFIG_H diff --git a/helpers/accounthelper.cpp b/helpers/accounthelper.cpp new file mode 100644 index 0000000..bef51a3 --- /dev/null +++ b/helpers/accounthelper.cpp @@ -0,0 +1,12 @@ + +#include "accounthelper.h" + +AccountHelper::AccountHelper(QObject *parent) : QObject(parent) +{ + +} + +bool AccountHelper::signedIn() +{ + return false; //TODO : implement +} diff --git a/helpers/accounthelper.h b/helpers/accounthelper.h new file mode 100644 index 0000000..3da6af4 --- /dev/null +++ b/helpers/accounthelper.h @@ -0,0 +1,30 @@ +/** + * Account helper + * + * @author Pierre HUBERT + */ + +#ifndef ACCOUNTHELPER_H +#define ACCOUNTHELPER_H + +#include + +class AccountHelper : public QObject +{ + Q_OBJECT +public: + explicit AccountHelper(QObject *parent = nullptr); + + /** + * Determine wether user is signed in or not + * + * @return TRUE if signed in / FALSE else + */ + bool signedIn(); + +signals: + +public slots: +}; + +#endif // ACCOUNTHELPER_H diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..b785638 --- /dev/null +++ b/main.cpp @@ -0,0 +1,22 @@ +/** + * @author Pierre HUBERT + */ + +#include + +#include "helpers/accounthelper.h" +#include "widgets/loginwidget.h" + +int main(int argc, char** argv){ + QApplication app(argc, argv); + + //Determine whether user is signed in or not + if(AccountHelper().signedIn()) + qFatal("Can not handle signed in users yet!"); + else { + LoginWidget *widget = new LoginWidget(); + widget->show(); + } + + return app.exec(); +} diff --git a/widgets/loginwidget.cpp b/widgets/loginwidget.cpp new file mode 100644 index 0000000..5b33ef0 --- /dev/null +++ b/widgets/loginwidget.cpp @@ -0,0 +1,14 @@ +#include "loginwidget.h" +#include "ui_loginwidget.h" + +LoginWidget::LoginWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::LoginWidget) +{ + ui->setupUi(this); +} + +LoginWidget::~LoginWidget() +{ + delete ui; +} diff --git a/widgets/loginwidget.h b/widgets/loginwidget.h new file mode 100644 index 0000000..51d1014 --- /dev/null +++ b/widgets/loginwidget.h @@ -0,0 +1,22 @@ +#ifndef LOGINWIDGET_H +#define LOGINWIDGET_H + +#include + +namespace Ui { +class LoginWidget; +} + +class LoginWidget : public QWidget +{ + Q_OBJECT + +public: + explicit LoginWidget(QWidget *parent = nullptr); + ~LoginWidget(); + +private: + Ui::LoginWidget *ui; +}; + +#endif // LOGINWIDGET_H diff --git a/widgets/loginwidget.ui b/widgets/loginwidget.ui new file mode 100644 index 0000000..f5fc787 --- /dev/null +++ b/widgets/loginwidget.ui @@ -0,0 +1,63 @@ + + + LoginWidget + + + + 0 + 0 + 402 + 107 + + + + Login to Comunic + + + + + + + + + + + Your email address + + + + + + + Email address + + + + + + + Password + + + + + + + Your password + + + + + + + + + Login + + + + + + + +