Ready to connect to the API

This commit is contained in:
Pierre HUBERT 2020-06-12 15:58:23 +02:00
parent 224069b43b
commit 9ad4255207
3 changed files with 38 additions and 10 deletions

View File

@ -1,6 +1,8 @@
#include "loginwindow.h" #include "loginwindow.h"
#include "ui_loginwindow.h" #include "ui_loginwindow.h"
#include <QMessageBox>
LoginWindow::LoginWindow(QWidget *parent) LoginWindow::LoginWindow(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::LoginWindow) , ui(new Ui::LoginWindow)
@ -30,10 +32,24 @@ void LoginWindow::mousePressEvent(QMouseEvent *evt)
void LoginWindow::mouseMoveEvent(QMouseEvent *evt) void LoginWindow::mouseMoveEvent(QMouseEvent *evt)
{ {
const QPoint delta = evt->globalPos() - mOldPos; const QPoint delta = evt->globalPos() - mOldPos;
if (false)
// if locked, ignore delta on y axis, stay at the top
move(x()+delta.x(), y());
else
move(x()+delta.x(), y()+delta.y()); move(x()+delta.x(), y()+delta.y());
mOldPos = evt->globalPos(); mOldPos = evt->globalPos();
} }
void LoginWindow::submitForm()
{
if(ui->emailEdit->text().isEmpty()) {
QMessageBox::warning(this, tr("Error"), tr("Please specify an email address!"));
return;
}
if(ui->passwordEdit->text().isEmpty()) {
QMessageBox::warning(this, tr("Error"), tr("Please specify your password!"));
return;
}
}
void LoginWindow::on_submitButton_clicked()
{
submitForm();
}

View File

@ -26,8 +26,15 @@ protected:
void mouseMoveEvent(QMouseEvent *evt); void mouseMoveEvent(QMouseEvent *evt);
private slots: private slots:
/**
* Submit login form
*/
void submitForm();
void on_closeButton_clicked(); void on_closeButton_clicked();
void on_submitButton_clicked();
private: private:
Ui::LoginWindow *ui; Ui::LoginWindow *ui;
QPoint mOldPos; QPoint mOldPos;

View File

@ -34,6 +34,7 @@ QLineEdit {
border: 1px solid grey; border: 1px solid grey;
border-radius: 0px; border-radius: 0px;
background-color: white; background-color: white;
color: black;
} }
QPushButton { QPushButton {
@ -128,7 +129,7 @@ QToolButton:hover:!pressed {
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="emailEdit"/>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
@ -138,10 +139,14 @@ QToolButton:hover:!pressed {
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit_2"/> <widget class="QLineEdit" name="passwordEdit">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item> </item>
<item alignment="Qt::AlignHCenter"> <item alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="submitButton">
<property name="text"> <property name="text">
<string>Login</string> <string>Login</string>
</property> </property>