mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
ref: segregate systems, codestyle, busy message
This commit is contained in:
97
Widgets/entrywidget.cpp
Normal file
97
Widgets/entrywidget.cpp
Normal file
@@ -0,0 +1,97 @@
|
||||
#include "entrywidget.h"
|
||||
#include "ui_entrywidget.h"
|
||||
|
||||
EntryWidget::EntryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::EntryWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
void EntryWidget::initialize(MainWindow *mainWindow)
|
||||
{
|
||||
ui->settingsWidget->hide();
|
||||
ui->offlineWidget->hide();
|
||||
ui->loginWidget->hide();
|
||||
this->mainWindow = mainWindow;
|
||||
|
||||
}
|
||||
|
||||
void EntryWidget::connectionEmptyState()
|
||||
{
|
||||
show();
|
||||
ui->offlineWidget->show();
|
||||
ui->loginWidget->hide();
|
||||
ui->settingsWidget->hide();
|
||||
}
|
||||
|
||||
void EntryWidget::settingsState()
|
||||
{
|
||||
ui->settingsWidget->show();
|
||||
ui->loginWidget->hide();
|
||||
ui->offlineWidget->hide();
|
||||
}
|
||||
|
||||
bool EntryWidget::isLoginFieldsFill()
|
||||
{
|
||||
return ui->loginInputField->text().length() <= 0 || ui->passwordInputField->text() <= 0;
|
||||
}
|
||||
|
||||
ClientAutorization* EntryWidget::getAuthData()
|
||||
{
|
||||
ClientAutorization *data = new ClientAutorization;
|
||||
QString username = ui->loginInputField->text();
|
||||
QString password = ui->passwordInputField->text();
|
||||
data->Login = username;
|
||||
data->Password = password;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ServerSettings *EntryWidget::getServerSettings()
|
||||
{
|
||||
ServerSettings *data = new ServerSettings;
|
||||
QString server = ui->serverInputField->text();
|
||||
QString port = ui->portInputField->text();
|
||||
|
||||
data->Address = server;
|
||||
data->Port = port;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void EntryWidget::loginIsActive(bool flag)
|
||||
{
|
||||
if(flag) ui->loginWidget->show();
|
||||
else ui->loginWidget->hide();
|
||||
}
|
||||
|
||||
void EntryWidget::settingsWidgetIsActive(bool flag)
|
||||
{
|
||||
if(flag) ui->settingsWidget->show();
|
||||
else ui->settingsWidget->hide();
|
||||
}
|
||||
|
||||
void EntryWidget::fillSettings(ServerSettings *settings)
|
||||
{
|
||||
ui->serverInputField->setText(settings->Address);
|
||||
ui->portInputField->setText(settings->Port);
|
||||
}
|
||||
|
||||
void EntryWidget::on_loginButton_clicked()
|
||||
{
|
||||
mainWindow->login();
|
||||
}
|
||||
|
||||
void EntryWidget::on_saveServerButton_clicked()
|
||||
{
|
||||
mainWindow->saveServerSettingsWithConnect();
|
||||
}
|
||||
|
||||
EntryWidget::~EntryWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user