mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
105 lines
2.1 KiB
C++
105 lines
2.1 KiB
C++
#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->offlineWidget->hide();
|
|
ui->loginWidget->hide();
|
|
ui->settingsWidget->hide();
|
|
this->mainWindow = mainWindow;
|
|
|
|
}
|
|
|
|
void EntryWidget::connectionEmptyState()
|
|
{
|
|
show();
|
|
ui->offlineWidget->show();
|
|
ui->loginWidget->hide();
|
|
}
|
|
|
|
void EntryWidget::settingsState()
|
|
{
|
|
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;
|
|
}
|
|
|
|
void EntryWidget::loginIsActive(bool flag)
|
|
{
|
|
if(flag)
|
|
{
|
|
ui->loginWidget->show();
|
|
ui->offlineWidget->hide();
|
|
}
|
|
else ui->loginWidget->hide();
|
|
}
|
|
|
|
void EntryWidget::on_loginButton_clicked()
|
|
{
|
|
mainWindow->login();
|
|
}
|
|
|
|
void EntryWidget::on_saveServerButton_clicked()
|
|
{
|
|
mainWindow->saveServerSettingsWithConnect();
|
|
}
|
|
|
|
ServerSettings *EntryWidget::getServerSettings()
|
|
{
|
|
ServerSettings *data = new ServerSettings;
|
|
QString server = ui->serverInputField->text();
|
|
QString port = ui->portInputField->text();
|
|
//bool checked = ui->mathModelUsecheckBox->isChecked();
|
|
|
|
data->Address = server;
|
|
data->Port = port;
|
|
data->mathModelUse = true;
|
|
|
|
return data;
|
|
}
|
|
|
|
void EntryWidget::fillSettings(ServerSettings *settings)
|
|
{
|
|
ui->serverInputField->setText(settings->Address);
|
|
ui->portInputField->setText(settings->Port);
|
|
//ui->mathModelUsecheckBox->setChecked(settings->mathModelUse);
|
|
}
|
|
|
|
void EntryWidget::isActive(bool flag)
|
|
{
|
|
if (flag) ui->settingsWidget->show();
|
|
else ui->settingsWidget->hide();
|
|
}
|
|
|
|
|
|
EntryWidget::~EntryWidget()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
|
|
|
|
|