comunicwatcher/loginwindow.cpp

56 lines
1.0 KiB
C++
Raw Normal View History

2020-06-12 12:22:37 +00:00
#include "loginwindow.h"
#include "ui_loginwindow.h"
2020-06-12 13:58:23 +00:00
#include <QMessageBox>
2020-06-12 12:22:37 +00:00
LoginWindow::LoginWindow(QWidget *parent)
2020-06-12 12:36:06 +00:00
: QDialog(parent)
2020-06-12 12:22:37 +00:00
, ui(new Ui::LoginWindow)
{
ui->setupUi(this);
2020-06-12 13:15:06 +00:00
setWindowFlag(Qt::FramelessWindowHint);
2020-06-12 12:22:37 +00:00
}
LoginWindow::~LoginWindow()
{
delete ui;
}
2020-06-12 13:15:06 +00:00
void LoginWindow::on_closeButton_clicked()
{
this->close();
}
2020-06-12 13:19:50 +00:00
void LoginWindow::mousePressEvent(QMouseEvent *evt)
{
mOldPos = evt->globalPos();
}
void LoginWindow::mouseMoveEvent(QMouseEvent *evt)
{
const QPoint delta = evt->globalPos() - mOldPos;
2020-06-12 13:58:23 +00:00
move(x()+delta.x(), y()+delta.y());
2020-06-12 13:19:50 +00:00
mOldPos = evt->globalPos();
}
2020-06-12 13:58:23 +00:00
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();
}