mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
App is running already
This commit is contained in:
@@ -51,3 +51,9 @@ target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibIn
|
||||
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/tasks)
|
||||
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/widgets)
|
||||
target_include_directories(ServerMTD PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/specialmessagebox)
|
||||
if(PROJECT_TYPE_DEBUG)
|
||||
target_link_directories(ServerMTD PUBLIC ${REPO_PATH}/BUILDS/Debug64/LibInstructorsAndTrainees)
|
||||
else()
|
||||
target_link_directories(ServerMTD PUBLIC ${REPO_PATH}/BUILDS/Release64/LibInstructorsAndTrainees)
|
||||
endif()
|
||||
target_link_libraries(ServerMTD PRIVATE libInstructorsAndTrainees.dll)
|
||||
|
||||
@@ -1,10 +1,50 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
//#include <QMessageBox>
|
||||
#include <QTranslator>
|
||||
#include "specialmessagebox.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
|
||||
// Уникальное имя для идентификации процесса
|
||||
const QString sharedMemKey = "ServerMTD_sharedMemKey";
|
||||
|
||||
// Создание объекта общей памяти
|
||||
QSharedMemory sharedMemory(sharedMemKey);
|
||||
|
||||
// Попытка прикрепления к существующему сегменту
|
||||
bool isRunningAlready = false;
|
||||
if (sharedMemory.attach(QSharedMemory::ReadWrite))
|
||||
{
|
||||
qWarning() << "App ServerMTD is running already!";
|
||||
|
||||
QTranslator qtLanguageTranslator;
|
||||
qtLanguageTranslator.load(QString("translations/RRJServer_") + "ru_RU", ".");
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
//QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("App ServerMTD is running already!"));
|
||||
SpecMsgBox::CriticalClose(nullptr, QObject::tr("App ") + QObject::tr("Maintenance training device RRJ-95NEW-100 Server") + QObject::tr(" is running already!"));
|
||||
isRunningAlready = true;
|
||||
} else
|
||||
{
|
||||
// Приложения ещё нет, создаём сегмент памяти
|
||||
if (!sharedMemory.create(1))
|
||||
{
|
||||
qCritical() << "Error create shared memory!";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (isRunningAlready)
|
||||
return 1;
|
||||
|
||||
// Освобождаем общую память при завершении работы приложения
|
||||
QObject::connect(qApp, &QCoreApplication::aboutToQuit,
|
||||
[&]() { sharedMemory.detach(); });
|
||||
|
||||
MainWindow w;
|
||||
w.show(); //Закоментировать, если нужно, чтобы по-умолчанию было свернуто в трее!
|
||||
return a.exec();
|
||||
|
||||
Binary file not shown.
@@ -1304,100 +1304,100 @@ Delete it anyway?</source>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.ui" line="375"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.ui" line="467"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="639"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="677"/>
|
||||
<source>none</source>
|
||||
<translation>нет</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="188"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="194"/>
|
||||
<source>The file could not be opened </source>
|
||||
<translation>Файл не может быть открыт </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="338"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="352"/>
|
||||
<source>Instructor authorization.</source>
|
||||
<translation>Авторизация инструктора.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="294"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="304"/>
|
||||
<source>Instructor deauthorization</source>
|
||||
<translation>Деавторизация инструктора</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="294"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="304"/>
|
||||
<source>Error!</source>
|
||||
<translation>Ошибка!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="306"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="318"/>
|
||||
<source>Server blocked!</source>
|
||||
<translation>Сервер заблокирован!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="306"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="318"/>
|
||||
<source>Instructor authorization is temporarily unavailable.</source>
|
||||
<translation>Авторизация инструктора временно недоступна.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="306"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="318"/>
|
||||
<source>Try again later.</source>
|
||||
<translation>Попробуйте позже.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="323"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="337"/>
|
||||
<source>Database error!</source>
|
||||
<translation>Ошибка базы данных!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="327"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="341"/>
|
||||
<source>The user is archived!</source>
|
||||
<translation>Пользователь является архивным!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="331"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="345"/>
|
||||
<source>The user is already logged in!</source>
|
||||
<translation>Пользователь уже в сети!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="335"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="349"/>
|
||||
<source>Login or password error!</source>
|
||||
<translation>Ошибка логина или пароля!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="434"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="448"/>
|
||||
<source>The server is not available!</source>
|
||||
<translation>Сервер недоступен!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="651"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="689"/>
|
||||
<source>Connection attempt</source>
|
||||
<translation>Попытка соединения</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="660"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="667"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="698"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="705"/>
|
||||
<source>connected</source>
|
||||
<translation>подключен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="660"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="698"/>
|
||||
<source>blocked</source>
|
||||
<translation>заблокирован</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="674"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="712"/>
|
||||
<source>not connected</source>
|
||||
<translation>не подключен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="724"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="762"/>
|
||||
<source>Server settings have been changed.
|
||||
Please reconnect to the server.</source>
|
||||
<translation>Настройки сервера были изменены.
|
||||
Пожалуйста, переподключитесь к серверу.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="508"/>
|
||||
<location filename="../LibInstructorsAndTrainees/instructorsandtraineeswidget.cpp" line="544"/>
|
||||
<source>Instructor authorization</source>
|
||||
<translation>Авторизация инструктора</translation>
|
||||
</message>
|
||||
@@ -1638,26 +1638,49 @@ Please reconnect to the server.</source>
|
||||
<source>FIM</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/trainees/personalcardtrainee.cpp" line="140"/>
|
||||
<source>The trainee was removed!</source>
|
||||
<translation>Обучаемый удален!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/trainees/personalcardtrainee.cpp" line="146"/>
|
||||
<source>The trainee was archived!</source>
|
||||
<translation>Обучаемый заархивирован!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../ProgramServerMTD/main.cpp" line="23"/>
|
||||
<source>Error</source>
|
||||
<translation>Ошибка</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ProgramServerMTD/main.cpp" line="23"/>
|
||||
<source>App ServerMTD is running already!</source>
|
||||
<translation>Программа ServerMTD уже запущена!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>RecognizeSystem</name>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="416"/>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="405"/>
|
||||
<source>The file could not be opened </source>
|
||||
<translation>Файл не может быть открыт </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="493"/>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="482"/>
|
||||
<source>You cannot delete the basic version!</source>
|
||||
<translation>Вы не можете удалить базовую версию!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="498"/>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="487"/>
|
||||
<source>You cannot delete the active version</source>
|
||||
<translation>Вы не можете удалить активную версию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="503"/>
|
||||
<location filename="../LibInstructorsAndTrainees/connectorToServer/Core/recognizesystem.cpp" line="492"/>
|
||||
<source>This name already exists</source>
|
||||
<translation>Это имя уже существует</translation>
|
||||
</message>
|
||||
@@ -1750,76 +1773,76 @@ Please reconnect to the server.</source>
|
||||
<translation>Ошибка PostgreSQL!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="238"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="240"/>
|
||||
<source>Server is started!</source>
|
||||
<translation>Сервер запущен!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="256"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="258"/>
|
||||
<source>Server is stoped!</source>
|
||||
<translation>Сервер остановлен!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="267"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="269"/>
|
||||
<source>Settings file could not be opened:</source>
|
||||
<translation>Файл настроек не открыт:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="296"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="298"/>
|
||||
<source>Database settings have been changed.
|
||||
The server will be restarted.</source>
|
||||
<translation>Настройки Базы Данных были изменены.
|
||||
Сервер будет перезапущен.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="345"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="347"/>
|
||||
<source>The file could not be opened </source>
|
||||
<translation>Файл не может быть открыт </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="428"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="432"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="433"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="437"/>
|
||||
<source>Database connection error!</source>
|
||||
<translation>Ошибка подключения Базы данных!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="449"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="454"/>
|
||||
<source>Database connection OK!</source>
|
||||
<translation>База данных подключена!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="465"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="470"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="475"/>
|
||||
<source>started</source>
|
||||
<translation>запущен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="470"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="475"/>
|
||||
<source>locked</source>
|
||||
<translation>заблокирован</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="476"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="481"/>
|
||||
<source>stoped</source>
|
||||
<translation>остановлен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="492"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="497"/>
|
||||
<source>connected</source>
|
||||
<translation>подключена</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="501"/>
|
||||
<location filename="../LibServer/serverlmswidget.cpp" line="506"/>
|
||||
<source>not connected</source>
|
||||
<translation>не подключен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.h" line="118"/>
|
||||
<location filename="../LibServer/serverlmswidget.h" line="119"/>
|
||||
<source>No Client files found!</source>
|
||||
<translation>Файлы клиента не найдены!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../LibServer/serverlmswidget.h" line="119"/>
|
||||
<location filename="../LibServer/serverlmswidget.h" line="120"/>
|
||||
<source>* check Application for the presence of a folder with a build
|
||||
* check SharedData for a folder with the base version and the name base</source>
|
||||
<translation>* проверьте Application на наличие папки со сборкой
|
||||
|
||||
Reference in New Issue
Block a user