Added login form

This commit is contained in:
Pierre HUBERT 2018-11-27 19:15:54 +01:00
parent 12e0e44ad3
commit 9f568d5ef6
8 changed files with 195 additions and 0 deletions

View File

@ -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

18
config.h Normal file
View File

@ -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

12
helpers/accounthelper.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "accounthelper.h"
AccountHelper::AccountHelper(QObject *parent) : QObject(parent)
{
}
bool AccountHelper::signedIn()
{
return false; //TODO : implement
}

30
helpers/accounthelper.h Normal file
View File

@ -0,0 +1,30 @@
/**
* Account helper
*
* @author Pierre HUBERT
*/
#ifndef ACCOUNTHELPER_H
#define ACCOUNTHELPER_H
#include <QObject>
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

22
main.cpp Normal file
View File

@ -0,0 +1,22 @@
/**
* @author Pierre HUBERT
*/
#include <QApplication>
#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();
}

14
widgets/loginwidget.cpp Normal file
View File

@ -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;
}

22
widgets/loginwidget.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H
#include <QWidget>
namespace Ui {
class LoginWidget;
}
class LoginWidget : public QWidget
{
Q_OBJECT
public:
explicit LoginWidget(QWidget *parent = nullptr);
~LoginWidget();
private:
Ui::LoginWidget *ui;
};
#endif // LOGINWIDGET_H

63
widgets/loginwidget.ui Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LoginWidget</class>
<widget class="QWidget" name="LoginWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>402</width>
<height>107</height>
</rect>
</property>
<property name="windowTitle">
<string>Login to Comunic</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="emailEdit">
<property name="inputMask">
<string/>
</property>
<property name="placeholderText">
<string>Your email address</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Email address</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="passwordEdit">
<property name="placeholderText">
<string>Your password</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Login</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>