changed login window to dialog #4168
This commit is contained in:
parent
da68664bda
commit
d1c1d79453
|
@ -15,7 +15,7 @@ FORMS += res/MainWindowBase.ui \
|
|||
res/SettingsDialogBase.ui \
|
||||
res/SetupWizardBase.ui \
|
||||
res/AddClientDialogBase.ui \
|
||||
res/LoginWindowBase.ui
|
||||
res/LoginDialogBase.ui
|
||||
SOURCES += src/main.cpp \
|
||||
src/MainWindow.cpp \
|
||||
src/AboutDialog.cpp \
|
||||
|
@ -52,8 +52,8 @@ SOURCES += src/main.cpp \
|
|||
src/DataDownloader.cpp \
|
||||
src/AddClientDialog.cpp \
|
||||
src/CommandProcess.cpp \
|
||||
src/LoginWindow.cpp \
|
||||
src/LoginAuth.cpp
|
||||
src/LoginAuth.cpp \
|
||||
src/LoginDialog.cpp
|
||||
HEADERS += src/MainWindow.h \
|
||||
src/AboutDialog.h \
|
||||
src/ServerConfig.h \
|
||||
|
@ -90,10 +90,10 @@ HEADERS += src/MainWindow.h \
|
|||
src/DataDownloader.h \
|
||||
src/AddClientDialog.h \
|
||||
src/CommandProcess.h \
|
||||
src/LoginWindow.h \
|
||||
src/LoginAuth.h \
|
||||
src/EditionType.h \
|
||||
src/LoginResult.h
|
||||
src/LoginResult.h \
|
||||
src/LoginDialog.h
|
||||
RESOURCES += res/Synergy.qrc
|
||||
RC_FILE = res/win/Synergy.rc
|
||||
macx {
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LoginDialog</class>
|
||||
<widget class="QDialog" name="LoginDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>175</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Synergy</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Synergy.qrc">:/res/image/about.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="horizontalSpacing">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Email:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditEmail">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditPassword">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string><a href="https://synergy-project.org/account/reset/">Forgot password</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pPushButtonLogin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Return</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Synergy.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef LOGINWINDOW_H
|
||||
#define LOGINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ui_LoginWindowBase.h"
|
||||
|
||||
class LoginWindow : public QMainWindow, public Ui::LoginWindowBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoginWindow(QWidget *parent = 0);
|
||||
~LoginWindow();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::LoginWindow *ui;
|
||||
};
|
||||
|
||||
#endif // LOGINWINDOW_H
|
|
@ -1,149 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LoginWindow</class>
|
||||
<widget class="QMainWindow" name="LoginWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Synergy</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="Synergy.qrc">:/res/image/about.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="leftMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="m_pLabelEmail">
|
||||
<property name="text">
|
||||
<string>Email:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditEmail">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="m_pLabelPassword">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditPassword">
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhHiddenText</set>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_pLabelRegister">
|
||||
<property name="text">
|
||||
<string><a href="http://synergy-project.org/">Register</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pPushButtonLogin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Login</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Return</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pPushButtonCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Esc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Synergy.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -47,7 +47,7 @@ class AppConfig
|
|||
friend class SettingsDialog;
|
||||
friend class MainWindow;
|
||||
friend class SetupWizard;
|
||||
friend class LoginWindow;
|
||||
friend class LoginDialog;
|
||||
|
||||
public:
|
||||
AppConfig(QSettings* settings);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "LoginAuth.h"
|
||||
|
||||
#include "LoginWindow.h"
|
||||
#include "LoginDialog.h"
|
||||
#include "AppConfig.h"
|
||||
#include "QUtility.h"
|
||||
#include "LoginResult.h"
|
||||
|
@ -28,16 +28,16 @@
|
|||
#include <QCryptographicHash>
|
||||
#include <stdexcept>
|
||||
|
||||
void LoginAuth::checkUserType()
|
||||
void LoginAuth::checkEditionType()
|
||||
{
|
||||
int edition = Unknown;
|
||||
int result = doCheckUserType(edition);
|
||||
m_pLoginWindow->setLoginResult(result);
|
||||
m_pLoginWindow->setEditionType(edition);
|
||||
int result = doCheckEditionType(edition);
|
||||
m_pLoginDialog->setLoginResult(result);
|
||||
m_pLoginDialog->setEditionType(edition);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
int LoginAuth::doCheckUserType(int& edition)
|
||||
int LoginAuth::doCheckEditionType(int& edition)
|
||||
{
|
||||
QString responseJson;
|
||||
|
||||
|
@ -47,7 +47,7 @@ int LoginAuth::doCheckUserType(int& edition)
|
|||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
m_pLoginWindow->setError(e.what());
|
||||
m_pLoginDialog->setError(e.what());
|
||||
return ExceptionError;
|
||||
}
|
||||
|
||||
|
@ -72,12 +72,12 @@ int LoginAuth::doCheckUserType(int& edition)
|
|||
|
||||
// replace "\n" with real new lines.
|
||||
QString error = errorRegex.cap(1).replace("\\n", "\n");
|
||||
m_pLoginWindow->setError(error);
|
||||
m_pLoginDialog->setError(error);
|
||||
return Error;
|
||||
}
|
||||
}
|
||||
|
||||
m_pLoginWindow->setError(responseJson);
|
||||
m_pLoginDialog->setError(responseJson);
|
||||
return ServerResponseError;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <QString>
|
||||
#include <QObject>
|
||||
|
||||
class LoginWindow;
|
||||
class LoginDialog;
|
||||
class AppConfig;
|
||||
|
||||
class LoginAuth : public QObject
|
||||
|
@ -29,13 +29,13 @@ class LoginAuth : public QObject
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int doCheckUserType(int& edition);
|
||||
int doCheckEditionType(int& edition);
|
||||
void setEmail(QString email) { m_Email = email; }
|
||||
void setPassword(QString password) { m_Password = password; }
|
||||
void setLoginWindow(LoginWindow* w) { m_pLoginWindow = w; }
|
||||
void setLoginDialog(LoginDialog* d) { m_pLoginDialog = d; }
|
||||
|
||||
public slots:
|
||||
void checkUserType();
|
||||
void checkEditionType();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
|
@ -46,7 +46,7 @@ private:
|
|||
private:
|
||||
QString m_Email;
|
||||
QString m_Password;
|
||||
LoginWindow* m_pLoginWindow;
|
||||
LoginDialog* m_pLoginDialog;
|
||||
};
|
||||
|
||||
#endif // LOGINAUTH_H
|
||||
|
|
|
@ -1,22 +1,4 @@
|
|||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Synergy Si Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "LoginWindow.h"
|
||||
#include "ui_LoginWindowBase.h"
|
||||
#include "LoginDialog.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "SetupWizard.h"
|
||||
|
@ -28,13 +10,17 @@
|
|||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QThread>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
LoginWindow::LoginWindow(
|
||||
static const char registerUrl[] = "http://synergy-project.org";
|
||||
|
||||
LoginDialog::LoginDialog(
|
||||
MainWindow* mainWindow,
|
||||
SetupWizard* setupWizard,
|
||||
bool wizardShouldRun,
|
||||
QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
QDialog(parent),
|
||||
m_pMainWindow(mainWindow),
|
||||
m_pSetupWizard(setupWizard),
|
||||
m_WizardShouldRun(wizardShouldRun),
|
||||
|
@ -44,18 +30,18 @@ LoginWindow::LoginWindow(
|
|||
m_AppConfig(m_pMainWindow->appConfig())
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setFixedSize(size());
|
||||
m_pLineEditEmail->setText(m_AppConfig.userEmail());
|
||||
}
|
||||
|
||||
LoginWindow::~LoginWindow()
|
||||
LoginDialog::~LoginDialog()
|
||||
{
|
||||
if (m_pLoginAuth != NULL) {
|
||||
delete m_pLoginAuth;
|
||||
}
|
||||
}
|
||||
|
||||
void LoginWindow::showNext()
|
||||
void LoginDialog::showNext()
|
||||
{
|
||||
if (m_LoginResult == ExceptionError) {
|
||||
QMessageBox::critical(
|
||||
|
@ -66,9 +52,9 @@ void LoginWindow::showNext()
|
|||
"following details.\n\n%1").arg(m_Error));
|
||||
}
|
||||
else if (m_LoginResult == InvalidEmailPassword) {
|
||||
QMessageBox::critical(
|
||||
QMessageBox::warning(
|
||||
this,
|
||||
tr("Error"),
|
||||
tr("Warning"),
|
||||
tr("Login failed, invalid email or password."));
|
||||
}
|
||||
else if (m_LoginResult == Error) {
|
||||
|
@ -98,8 +84,8 @@ void LoginWindow::showNext()
|
|||
QString mac = getFirstMacAddress();
|
||||
QString hashSrc = m_pLineEditEmail->text() + mac;
|
||||
QString hashResult = hash(hashSrc);
|
||||
m_AppConfig.setUserToken(hashResult);
|
||||
m_AppConfig.setEditionType(m_EditionType);
|
||||
//m_AppConfig.setUserToken(hashResult);
|
||||
//m_AppConfig.setEditionType(m_EditionType);
|
||||
}
|
||||
}
|
||||
m_pMainWindow->show();
|
||||
|
@ -112,9 +98,11 @@ void LoginWindow::showNext()
|
|||
m_EditionType = Unknown;
|
||||
m_pPushButtonLogin->setEnabled(true);
|
||||
m_pPushButtonLogin->setDefault(true);
|
||||
m_pLineEditEmail->setEnabled(true);
|
||||
m_pLineEditPassword->setEnabled(true);
|
||||
}
|
||||
|
||||
bool LoginWindow::validEmailPassword()
|
||||
bool LoginDialog::validEmailPassword()
|
||||
{
|
||||
if (m_pLineEditEmail->text().isEmpty() ||
|
||||
m_pLineEditPassword->text().isEmpty()) {
|
||||
|
@ -128,32 +116,35 @@ bool LoginWindow::validEmailPassword()
|
|||
return true;
|
||||
}
|
||||
|
||||
void LoginWindow::changeEvent(QEvent *e)
|
||||
void LoginDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void LoginWindow::closeEvent(QCloseEvent *event)
|
||||
|
||||
void LoginDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
showNext();
|
||||
}
|
||||
|
||||
void LoginWindow::on_m_pPushButtonLogin_clicked()
|
||||
void LoginDialog::on_m_pPushButtonLogin_clicked()
|
||||
{
|
||||
if (validEmailPassword()) {
|
||||
if (m_pLoginAuth == NULL) {
|
||||
m_pLoginAuth = new LoginAuth();
|
||||
m_pLoginAuth->setLoginWindow(this);
|
||||
m_pLoginAuth->setLoginDialog(this);
|
||||
}
|
||||
|
||||
m_pPushButtonLogin->setEnabled(false);
|
||||
m_pLineEditEmail->setEnabled(false);
|
||||
m_pLineEditPassword->setEnabled(false);
|
||||
|
||||
QString email = m_pLineEditEmail->text();
|
||||
QString password = m_pLineEditPassword->text();
|
||||
|
@ -168,11 +159,14 @@ void LoginWindow::on_m_pPushButtonLogin_clicked()
|
|||
m_pLoginAuth->moveToThread(thread);
|
||||
thread->start();
|
||||
|
||||
QMetaObject::invokeMethod(m_pLoginAuth, "checkUserType", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(m_pLoginAuth, "checkEditionType", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginWindow::on_m_pPushButtonCancel_clicked()
|
||||
{
|
||||
showNext();
|
||||
void LoginDialog::keyPressEvent(QKeyEvent* e) {
|
||||
if(e->key() != Qt::Key_Escape)
|
||||
QDialog::keyPressEvent(e);
|
||||
else {
|
||||
close();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
#ifndef LOGINDIALOG_H
|
||||
#define LOGINDIALOG_H
|
||||
|
||||
#include "ui_LoginDialogBase.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class MainWindow;
|
||||
class SetupWizard;
|
||||
class LoginAuth;
|
||||
class AppConfig;
|
||||
|
||||
class LoginDialog : public QDialog, public Ui::LoginDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoginDialog(MainWindow* mainWindow,
|
||||
SetupWizard* setupWizard,
|
||||
bool wizardShouldRun,
|
||||
QWidget *parent = 0);
|
||||
~LoginDialog();
|
||||
|
||||
void setLoginResult(int result) { m_LoginResult = result; }
|
||||
void setEditionType(int type) { m_EditionType = type; }
|
||||
void setError(QString error) { m_Error = error; }
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
|
||||
private slots:
|
||||
void on_m_pPushButtonLogin_clicked();
|
||||
void showNext();
|
||||
|
||||
private:
|
||||
bool validEmailPassword();
|
||||
|
||||
private:
|
||||
MainWindow* m_pMainWindow;
|
||||
SetupWizard* m_pSetupWizard;
|
||||
bool m_WizardShouldRun;
|
||||
LoginAuth* m_pLoginAuth;
|
||||
int m_LoginResult;
|
||||
int m_EditionType;
|
||||
QString m_Error;
|
||||
AppConfig& m_AppConfig;
|
||||
};
|
||||
|
||||
#endif // LOGINDIALOG_H
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2015 Synergy Si Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LOGINWINDOW_H
|
||||
#define LOGINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "ui_LoginWindowBase.h"
|
||||
|
||||
class MainWindow;
|
||||
class SetupWizard;
|
||||
class LoginAuth;
|
||||
class AppConfig;
|
||||
|
||||
class LoginWindow : public QMainWindow, public Ui::LoginWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoginWindow(MainWindow* mainWindow,
|
||||
SetupWizard* setupWizard,
|
||||
bool wizardShouldRun,
|
||||
QWidget *parent = 0);
|
||||
~LoginWindow();
|
||||
|
||||
void setLoginResult(int result) { m_LoginResult = result; }
|
||||
void setEditionType(int type) { m_EditionType = type; }
|
||||
void setError(QString error) { m_Error = error; }
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_m_pPushButtonCancel_clicked();
|
||||
void on_m_pPushButtonLogin_clicked();
|
||||
void showNext();
|
||||
|
||||
private:
|
||||
bool validEmailPassword();
|
||||
private:
|
||||
MainWindow* m_pMainWindow;
|
||||
SetupWizard* m_pSetupWizard;
|
||||
bool m_WizardShouldRun;
|
||||
LoginAuth* m_pLoginAuth;
|
||||
int m_LoginResult;
|
||||
int m_EditionType;
|
||||
QString m_Error;
|
||||
AppConfig& m_AppConfig;
|
||||
|
||||
};
|
||||
|
||||
#endif // LOGINWINDOW_H
|
|
@ -23,7 +23,7 @@
|
|||
#include "MainWindow.h"
|
||||
#include "AppConfig.h"
|
||||
#include "SetupWizard.h"
|
||||
#include "LoginWindow.h"
|
||||
#include "LoginDialog.h"
|
||||
#include "QUtility.h"
|
||||
#include "LoginResult.h"
|
||||
|
||||
|
@ -95,7 +95,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
MainWindow mainWindow(settings, appConfig);
|
||||
SetupWizard setupWizard(mainWindow, true);
|
||||
LoginWindow loginWindow(
|
||||
LoginDialog loginDialog(
|
||||
&mainWindow,
|
||||
&setupWizard,
|
||||
appConfig.wizardShouldRun());
|
||||
|
@ -109,7 +109,7 @@ int main(int argc, char* argv[])
|
|||
mainWindow.show();
|
||||
}
|
||||
else {
|
||||
loginWindow.show();
|
||||
loginDialog.show();
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
|
|
Loading…
Reference in New Issue