diff --git a/DataBaseLMS/databaselms.cpp b/DataBaseLMS/databaselms.cpp
index 7fef49c..900ddf3 100644
--- a/DataBaseLMS/databaselms.cpp
+++ b/DataBaseLMS/databaselms.cpp
@@ -94,7 +94,7 @@ DataBaseSettings DataBaseLMS::getDataBaseSettings()
QFile file("config/settings.xml");
if(!file.open(QIODevice::ReadOnly))
{
- QMessageBox::critical(ownerWidget, tr("Attention!"), tr("The file could not be opened:") + "config/settings.xml");
+ //QMessageBox::critical(ownerWidget, tr("Attention!"), tr("The file could not be opened:") + "config/settings.xml");
return settings;
}
QXmlStreamReader xmlReader(&file);
@@ -234,8 +234,18 @@ void DataBaseLMS::messageWarningErrorQuery(QString queryStr, QSqlQuery* query)
//Сообщение об ошибке
- QMessageBox::warning(ownerWidget, dbSettings.dbName,
+ /*
+ QWidget* owner = ownerWidget;
+ QMessageBox::critical(ownerWidget, tr("Error PostgreSQL!"),
+ //dbSettings.dbName
"Error query:\n" + query->lastError().text() + "\n" +
"String of query:\n" + queryStr + "\n" +
"Executed query:\n" + query->executedQuery());
+ */
+
+ QString textError = "";
+ textError = "Error query:\n" + query->lastError().text() + "\n" +
+ "String of query:\n" + queryStr + "\n" +
+ "Executed query:\n" + query->executedQuery();
+ emit signal_ErrorPostgreSQL(textError);
}
diff --git a/DataBaseLMS/databaselms.h b/DataBaseLMS/databaselms.h
index e8e28a2..b18a2e1 100644
--- a/DataBaseLMS/databaselms.h
+++ b/DataBaseLMS/databaselms.h
@@ -35,6 +35,9 @@ public:
public Q_SLOTS:
void slot_LanguageChanged(QString language);
+signals:
+ void signal_ErrorPostgreSQL(QString text);
+
public:
static const QString TypeUserDBInstructor;
static const QString TypeUserDBTrainee;
diff --git a/DataBaseLMS/translations/DataBaseLMS_ru_RU.ts b/DataBaseLMS/translations/DataBaseLMS_ru_RU.ts
index 09f1c10..45a201f 100644
--- a/DataBaseLMS/translations/DataBaseLMS_ru_RU.ts
+++ b/DataBaseLMS/translations/DataBaseLMS_ru_RU.ts
@@ -4,12 +4,12 @@
DataBaseLMS
-
+
Attention!
Внимание!
-
+
The file could not be opened:
Файл не может быть открыт:
diff --git a/InstructorsAndTrainees/translations/InstructorsAndTraineesWidget_ru_RU.ts b/InstructorsAndTrainees/translations/InstructorsAndTraineesWidget_ru_RU.ts
index 66c446c..5c2cedf 100644
--- a/InstructorsAndTrainees/translations/InstructorsAndTraineesWidget_ru_RU.ts
+++ b/InstructorsAndTrainees/translations/InstructorsAndTraineesWidget_ru_RU.ts
@@ -222,31 +222,31 @@ The status will be set:
- DialogAuthorizationInstructor
+ DialogAuthorization
-
+
Instructor authorization
- Авторизация инструктора
+ Авторизация инструктора
-
+
Login
- Логин
+ Логин
-
- ...
-
-
-
-
- Log in
- Войти
-
-
-
+
Password
- Пароль
+ Пароль
+
+
+
+ ...
+
+
+
+
+ Log in
+ Войти
@@ -423,42 +423,42 @@ The status will be set:
Язык
-
+
Server
Сервер
-
+
Address
Адрес
-
+
Port
Порт
-
+
Auto start
Авто старт
-
+
Save
Сохранить
-
+
Additional
Расширенные
-
+
Version
Версия
-
+
Style
Стиль
@@ -796,7 +796,7 @@ Delete it anyway?
-
+
none
нет
@@ -826,17 +826,17 @@ Delete it anyway?
Сервер недоступен!
-
+
connected
подключен
-
+
not connected
не подключен
-
+
Server settings have been changed. Please reconnect to the server.
Настройки сервера изменены. Выполните переподключение к серверу.
diff --git a/ServerLMS/dialogsettingstray.cpp b/ServerLMS/dialogsettingstray.cpp
index a4097d0..6e5951c 100644
--- a/ServerLMS/dialogsettingstray.cpp
+++ b/ServerLMS/dialogsettingstray.cpp
@@ -64,11 +64,26 @@ DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *pa
ui->editPort->setText(settings->Port);
ui->editUserName->setText(settings->UserName);
ui->editPassword->setText(settings->Password);
- }
- ui->btnSave->setEnabled(false);
- ui->btnCheckDB->setEnabled(true);
- flSettingsServerChanged = false;
+ ui->btnSave->setEnabled(false);
+ ui->btnCheckDB->setEnabled(true);
+ flSettingsServerChanged = false;
+ }
+ else
+ {
+ ui->checkLocalhost->setChecked(true);
+ //ui->editHostName->setEnabled(true);
+ ui->editPort->setEnabled(true);
+ ui->editNameDB->setEnabled(true);
+ ui->editUserName->setEnabled(true);
+ ui->editPassword->setEnabled(true);
+
+ ui->btnSave->setEnabled(false);
+
+ ui->btnSave->setEnabled(false);
+ ui->btnCheckDB->setEnabled(false);
+ flSettingsServerChanged = false;
+ }
}
DialogSettingsTray::~DialogSettingsTray()
diff --git a/ServerLMS/providerdblms.cpp b/ServerLMS/providerdblms.cpp
index 12486e7..1a2a57e 100644
--- a/ServerLMS/providerdblms.cpp
+++ b/ServerLMS/providerdblms.cpp
@@ -9,6 +9,7 @@ ProviderDBLMS::ProviderDBLMS(QWidget *parentWidget, QObject *parent) :
parentWidget(parentWidget)
{
dbLMS = new InterfaceDataBaseLMS(parentWidget);
+ connect(dbLMS, &InterfaceDataBaseLMS::signal_ErrorPostgreSQL, this, &ProviderDBLMS::signal_ErrorPostgreSQL);
}
ProviderDBLMS::~ProviderDBLMS()
diff --git a/ServerLMS/providerdblms.h b/ServerLMS/providerdblms.h
index 3abe9e3..2c58257 100644
--- a/ServerLMS/providerdblms.h
+++ b/ServerLMS/providerdblms.h
@@ -73,6 +73,8 @@ public:
Q_SIGNALS:
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
+signals:
+ void signal_ErrorPostgreSQL(QString text);
public:
bool ConnectionToDB();
diff --git a/ServerLMS/serverlmswidget.cpp b/ServerLMS/serverlmswidget.cpp
index 59924a6..e5c8f0a 100644
--- a/ServerLMS/serverlmswidget.cpp
+++ b/ServerLMS/serverlmswidget.cpp
@@ -107,6 +107,12 @@ void ServerLMSWidget::slot_AddMessageToLog(QString message)
ui->loggerTextField->appendPlainText(message);
}
+void ServerLMSWidget::slot_ErrorPostgreSQL(QString text)
+{
+ emit signal_Menu_ShowWindow();
+ QMessageBox::critical(this, tr("Error PostgreSQL!"),text);
+}
+
void ServerLMSWidget::start()
{
startInitialization();
@@ -170,6 +176,13 @@ void ServerLMSWidget::on_btnStopServer_clicked()
void ServerLMSWidget::on_btnSettings_clicked()
{
+ ServerDBSettings settingsTemp;
+ if(!DialogSettingsTray::loadSettings(&settingsTemp))
+ {
+ QMessageBox::critical(this, tr("Error!"), tr("Settings file could not be opened:") + "'config/settings.xml'");
+ return;
+ }
+
DialogSettingsTray dlg(providerDBLMS, this);
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
@@ -258,6 +271,7 @@ QString ServerLMSWidget::loadStyleSheet()
void ServerLMSWidget::startInitialization()
{
providerDBLMS = new ProviderDBLMS(this);
+ connect(providerDBLMS, &ProviderDBLMS::signal_ErrorPostgreSQL, this, &ServerLMSWidget::slot_ErrorPostgreSQL);
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
mutex = new QMutex;
diff --git a/ServerLMS/serverlmswidget.h b/ServerLMS/serverlmswidget.h
index f4f91fa..7b9cda4 100644
--- a/ServerLMS/serverlmswidget.h
+++ b/ServerLMS/serverlmswidget.h
@@ -82,6 +82,8 @@ public slots:
void slot_BlockAutorization(bool block);
void slot_AddMessageToLog(QString message);
+ void slot_ErrorPostgreSQL(QString text);
+
public:
QString getLanguage()
{
diff --git a/ServerLMS/translations/ServerLMS_ru_RU.ts b/ServerLMS/translations/ServerLMS_ru_RU.ts
index 5950c1d..153d206 100644
--- a/ServerLMS/translations/ServerLMS_ru_RU.ts
+++ b/ServerLMS/translations/ServerLMS_ru_RU.ts
@@ -13,7 +13,7 @@
DialogCheckDB
-
+
Database
База данных
@@ -24,67 +24,72 @@
-
-
-
+
+
...
-
+
User
Пользователь
-
+
Repare
Восстановить
-
+
Installed
Установлен
-
+
Not installed
Не установлен
-
-
+
+
Exist
Существует
-
-
+
+
Not exist
Не существует
-
- Warning!
- Внимание!
+
+ Completed!
+
-
+
+ The database has been successfully restored!
+
+
+
+
Install PostgreSQL.
Установите PostgreSQL.
-
-
+
+
+
Error!
Ошибка!
-
+
Failed to create user!
Ошибка создания пользователя!
-
+
Failed to create Database!
Ошибка создания Базы данных!
@@ -106,46 +111,101 @@
Language
Язык
-
-
- Data Base
- База Данных
-
- DB name
- Имя БД
+ Database
+ База данных
-
+
Host name
Хост
-
+
+ Localhost
+
+
+
+
Port
Порт
-
+
+ Database name
+
+
+
+
User name
Имя пользователя
-
- Password
- Пароль
+
+ User password
+
-
- Check DB
- Проверить БД
+
+ Check&&Repare
+
-
+
Save
Сохранить
+
+
+
+
+ Error!
+ Ошибка!
+
+
+
+ Driver PostgreSQL is not installed!
+
+
+
+
+ Superuser PostgreSQL authorization
+
+
+
+
+
+ Error connecting to PostgreSQL!
+
+
+
+
+
+ Possible reasons:
+
+
+
+
+
+ *superuser PostgreSQL login or password is incorrect;
+
+
+
+
+ *Port is incorrect.
+
+
+
+
+ *Port is incorrect;
+
+
+
+
+ *file 'pg_hba.conf' does not contain an entry for the IP address:
+
+
ServerLMSWidget
@@ -201,66 +261,66 @@
Остановить
-
+
Server is started!
Сервер запущен!
-
+
Server is stoped!
Сервер остановлен!
-
-
+
+
Warning!
Внимание!
-
+
Database settings have been changed.
The server will be restarted.
Настройки Базы Данных были изменены.
Сервер будет перезапущен.
-
+
The file could not be opened
Файл не может быть открыт
-
-
+
+
Database connection error!
Ошибка подключения Базы данных!
-
+
Error!
Ошибка!
-
+
Database connection OK!
База данных подключена!
-
+
started
запущен
-
+
stoped
остановлен
-
+
connected
подключена
-
+
not connected
не подключена
diff --git a/TrayServerLMS/mainwindow.cpp b/TrayServerLMS/mainwindow.cpp
index 74c89c5..1ffaaa5 100644
--- a/TrayServerLMS/mainwindow.cpp
+++ b/TrayServerLMS/mainwindow.cpp
@@ -64,11 +64,7 @@ MainWindow::MainWindow(QWidget *parent) :
trayIcon->setContextMenu(trayMenu);
trayIcon->show();
- slot_Tray_ShowMessage(tr("Starting the server..."));
-
- serverLMSWidget->start();
-
- errorCheck();
+ slot_Tray_ShowMessage(tr("Starting the server..."));
QTimer::singleShot(1000,this,&MainWindow::slot_Connect);
}
@@ -181,6 +177,10 @@ void MainWindow::slot_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::Message
void MainWindow::slot_Connect()
{
+ serverLMSWidget->start();
+
+ errorCheck();
+
/* Также подключаем сигнал нажатия на иконку к обработчику
* данного нажатия
* */
diff --git a/TrayServerLMS/translations/TrayServerLMS_ru_RU.ts b/TrayServerLMS/translations/TrayServerLMS_ru_RU.ts
index 162aa42..79c2ea4 100644
--- a/TrayServerLMS/translations/TrayServerLMS_ru_RU.ts
+++ b/TrayServerLMS/translations/TrayServerLMS_ru_RU.ts
@@ -9,58 +9,47 @@
Сервер Системы управления обучением (СУО)
-
-
-
+
+
Server LMS
Сервер СУО
-
-
+
Expand window
Развернуть окно
-
-
+
Minimize window
Свернуть окно
-
-
+
Exit
Выход
-
+
Starting the server...
Запуск сервера...
-
+
Error!
Ошибка!
-
+
No Client files found!
Файлы Клиента не найдены!
-
+
* check Application for the presence of a folder with a build
* check SharedData for a folder with the base version and the name base
* проверьте Application на наличие папки со сборкой
* проверьте SharedData на наличие папки с базовой версией и именем base
-
-
- The application is minimized to the tray.
-To maximize the application window, click the application icon in the tray.
- Приложение свёрнуто в область уведомлений.
-Чтобы развернуть окно приложения, нажмите на значок приложения в области уведомлений.
-