mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Merge branch 'work29' into DEV
This commit is contained in:
@@ -86,6 +86,7 @@ target_link_libraries(ServerLMS PRIVATE libDataBaseLMS.dll)
|
||||
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees)
|
||||
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/authorization)
|
||||
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/tasks)
|
||||
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/widgets)
|
||||
if(PROJECT_TYPE_DEBUG)
|
||||
target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
|
||||
else()
|
||||
|
||||
@@ -110,6 +110,8 @@ QString AssetsManager::setVersion(QString versionName)
|
||||
currentVersionData = version;
|
||||
saveVersionToFile(currentVersionData);
|
||||
|
||||
emit signal_setVersion(versionName);
|
||||
|
||||
return version->getAbsolutPath();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
|
||||
signals:
|
||||
void sigSaveVersion(StreamingVersionData *versionData);
|
||||
void signal_setVersion(QString versionStr);
|
||||
|
||||
private:
|
||||
UpdateController *updateController;
|
||||
|
||||
@@ -55,6 +55,11 @@ void Logger::handleLog(QString msg, LogLevel logLevel)
|
||||
{
|
||||
QString level;
|
||||
|
||||
#ifndef PROJECT_TYPE_DEBUG
|
||||
if(logLevel == DEBUG)
|
||||
return;
|
||||
#endif
|
||||
|
||||
switch (logLevel)
|
||||
{
|
||||
case INFO: level = "INFO"; break;
|
||||
|
||||
@@ -38,6 +38,8 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
|
||||
|
||||
mutex = new QMutex;
|
||||
qDebug() << "UpdateController init thread ID " << QThread::currentThreadId();
|
||||
|
||||
emit sigInitializeFinished();
|
||||
}
|
||||
|
||||
void UpdateController::changeAssetVersion(QString versionName)
|
||||
|
||||
@@ -69,6 +69,8 @@ signals:
|
||||
void sigErrorRequired(int code);
|
||||
void sigUpdateDocs();
|
||||
|
||||
void sigInitializeFinished();
|
||||
|
||||
private:
|
||||
QList<FileData> clientDataList;
|
||||
QList<FileData> serverDataList;
|
||||
|
||||
@@ -16,6 +16,7 @@ const QString ServerLMSWidget::languageRUS = "ru_RU";
|
||||
ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ServerLMSWidget),
|
||||
waitAnimationWidget(nullptr),
|
||||
server(nullptr),
|
||||
updateThread(nullptr),
|
||||
loggerThread(nullptr),
|
||||
@@ -42,6 +43,13 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
||||
updateMyStyleSheet();
|
||||
|
||||
setLanguageInterfase();
|
||||
|
||||
waitAnimationWidget = new WaitAnimationWidget;
|
||||
QMovie *movie = new QMovie(":/resources/icons/762.gif");
|
||||
waitAnimationWidget->setParent(this);
|
||||
waitAnimationWidget->initialize(movie,this);
|
||||
|
||||
waitAnimationWidget->showWithPlay();
|
||||
}
|
||||
|
||||
ServerLMSWidget::~ServerLMSWidget()
|
||||
@@ -72,6 +80,9 @@ ServerLMSWidget::~ServerLMSWidget()
|
||||
delete providerDBLMS;
|
||||
}
|
||||
|
||||
waitAnimationWidget->hideWithStop();
|
||||
delete waitAnimationWidget;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -86,6 +97,12 @@ void ServerLMSWidget::changeEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void ServerLMSWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QSize size = event->size();
|
||||
waitAnimationWidget->resize(size);
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_UpdateListClients()
|
||||
{
|
||||
//Очищаем список
|
||||
@@ -125,12 +142,39 @@ void ServerLMSWidget::slot_UpdateDocs()
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::start()
|
||||
void ServerLMSWidget::slot_startInitialization_step1()
|
||||
{
|
||||
startInitialization();
|
||||
Logger::instance().log("Update docs.xml...");
|
||||
slot_UpdateDocs();
|
||||
Logger::instance().log("Update docs.xml completed!");
|
||||
|
||||
ui->btnStopServer->setEnabled(false);
|
||||
ui->btnStartServer->setEnabled(true);
|
||||
|
||||
flStartInitialization = true;
|
||||
|
||||
updateStateServer();
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if(hasError() == 100)
|
||||
return;
|
||||
|
||||
Logger::instance().log("Try connection to DB...");
|
||||
tryConnectionToDB();
|
||||
|
||||
waitAnimationWidget->hideWithStop();
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_setVersion(QString versionStr)
|
||||
{
|
||||
ui->lblVersionText->setText(versionStr);
|
||||
}
|
||||
|
||||
void ServerLMSWidget::start()
|
||||
{
|
||||
startInitialization_step0();
|
||||
|
||||
}
|
||||
|
||||
void ServerLMSWidget::slot_BlockAutorization(bool block)
|
||||
@@ -296,7 +340,7 @@ QString ServerLMSWidget::loadStyleSheet()
|
||||
}
|
||||
}
|
||||
|
||||
void ServerLMSWidget::startInitialization()
|
||||
void ServerLMSWidget::startInitialization_step0()
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
@@ -317,7 +361,8 @@ void ServerLMSWidget::startInitialization()
|
||||
updateController = new UpdateController;
|
||||
updateController->moveToThread(updateThread);
|
||||
|
||||
docsUpdater = new DocsUpdater(updateController, this);
|
||||
docsUpdater = new DocsUpdater(updateController/*, this*/);
|
||||
docsUpdater->moveToThread(updateThread);
|
||||
|
||||
processingSystem = new ProcessingSystem(providerDBLMS, updateController, docsUpdater);
|
||||
|
||||
@@ -340,24 +385,16 @@ void ServerLMSWidget::startInitialization()
|
||||
Logger::instance().setLoggingType(LoggingType::WIDGET);
|
||||
Logger::instance().setLogToFile(true);
|
||||
|
||||
connect(this,&ServerLMSWidget::sigUpdateController,updateController,&UpdateController::initialize,Qt::DirectConnection);
|
||||
connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize/*,Qt::DirectConnection*/);
|
||||
connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/);
|
||||
connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
|
||||
connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError);
|
||||
connect(updateController,&UpdateController::sigUpdateDocs,this,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection);
|
||||
connect(&Logger::instance(),&Logger::sigLogToWidget,this, &ServerLMSWidget::slot_AddMessageToLog,Qt::QueuedConnection);
|
||||
|
||||
emit sigUpdateController(commonClientHandler,dataParser,assetsManager);
|
||||
connect(assetsManager,&AssetsManager::signal_setVersion, this, &ServerLMSWidget::slot_setVersion);
|
||||
|
||||
slot_UpdateDocs();
|
||||
|
||||
ui->btnStopServer->setEnabled(false);
|
||||
ui->btnStartServer->setEnabled(true);
|
||||
|
||||
flStartInitialization = true;
|
||||
|
||||
updateStateServer();
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
emit sigUpdateControllerInitialize(commonClientHandler,dataParser,assetsManager);
|
||||
}
|
||||
|
||||
void ServerLMSWidget::tryConnectionToDB()
|
||||
@@ -383,6 +420,8 @@ void ServerLMSWidget::tryConnectionToDB()
|
||||
dbSettings.dbHostName,
|
||||
QString::number(dbSettings.dbPort));
|
||||
|
||||
Logger::instance().log("Connection to DB completed!");
|
||||
|
||||
emit signal_Tray_ShowMessage(tr("Database connection OK!") + "\n" + strDBsettings);
|
||||
|
||||
on_btnStartServer_clicked();
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#include "providerdblms.h"
|
||||
#include "docsupdater.h"
|
||||
|
||||
#include "waitanimationwidget.h"
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class ServerLMSWidget;
|
||||
@@ -64,6 +68,8 @@ protected:
|
||||
// В нём будет производиться проверка события смены перевода приложения
|
||||
void changeEvent(QEvent * event) override;
|
||||
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
signals:
|
||||
//сигнал смены языка
|
||||
void signal_LanguageChanged(QString language);
|
||||
@@ -76,7 +82,7 @@ signals:
|
||||
|
||||
void sigRecognize();
|
||||
void sigCalculateFullHash();
|
||||
void sigUpdateController(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
|
||||
void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
|
||||
QTcpSocket* sigGetSocket();
|
||||
|
||||
void signal_DocsChanged();
|
||||
@@ -91,6 +97,10 @@ public slots:
|
||||
|
||||
void slot_UpdateDocs();
|
||||
|
||||
void slot_startInitialization_step1();
|
||||
|
||||
void slot_setVersion(QString versionStr);
|
||||
|
||||
public:
|
||||
QString getLanguage()
|
||||
{
|
||||
@@ -130,7 +140,7 @@ private:
|
||||
void updateMyStyleSheet();
|
||||
QString loadStyleSheet();
|
||||
|
||||
void startInitialization();
|
||||
void startInitialization_step0();
|
||||
|
||||
void tryConnectionToDB();
|
||||
|
||||
@@ -140,7 +150,7 @@ private:
|
||||
Ui::ServerLMSWidget *ui;
|
||||
|
||||
private:
|
||||
//WaitAnimationWidget *waitAnimationWidget;
|
||||
WaitAnimationWidget *waitAnimationWidget;
|
||||
|
||||
MultiThreadServer *server;
|
||||
QThread *updateThread;
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -298,65 +298,108 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDBsettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Version">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QLabel" name="label_Version">
|
||||
<property name="text">
|
||||
<string>Version of materials: </string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Block">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Authorization</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBlockAuth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="ServerLMS.qrc">:/resources/icons/lock.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QLabel" name="lblVersionText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_Block">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Authorization</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBlockAuth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="ServerLMS.qrc">:/resources/icons/lock.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
@@ -297,10 +297,8 @@ void DialogSettingsTray::on_btnCheckDB_clicked()
|
||||
dlg.setWindowTitle(tr("Superuser PostgreSQL authorization"));
|
||||
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
dlg.setStyleSheet(this->styleSheet());
|
||||
#ifdef PROJECT_TYPE_DEBUG
|
||||
dlg.setLogin("postgres");
|
||||
dlg.setPassword("");
|
||||
#endif
|
||||
|
||||
switch( dlg.exec() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user