mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
допилил ownerWidget в DataBaseLMS
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
const QString DataBaseLMS::TypeUserDBInstructor = "instructor";
|
||||
const QString DataBaseLMS::TypeUserDBTrainee = "trainee";
|
||||
|
||||
DataBaseLMS::DataBaseLMS(QWidget *ownerWidget):
|
||||
DataBaseLMS::DataBaseLMS(QWidget *ownerWidget, QObject *parent):
|
||||
QObject(parent),
|
||||
db(nullptr),
|
||||
transactionBegined(false),
|
||||
ownerWidget(ownerWidget)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,12 @@ DataBaseLMS::~DataBaseLMS()
|
||||
deleteConnection();
|
||||
}
|
||||
|
||||
void DataBaseLMS::slot_LanguageChanged(QString language)
|
||||
{
|
||||
qtLanguageTranslator.load(QString(QStringLiteral("translations/DataBaseLMS_")) + language, QStringLiteral("."));
|
||||
QCoreApplication::installTranslator(&qtLanguageTranslator);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::createConnection()
|
||||
{
|
||||
dbSettings = getDataBaseSettings();
|
||||
@@ -52,9 +58,6 @@ bool DataBaseLMS::createConnection()
|
||||
|
||||
void DataBaseLMS::deleteConnection()
|
||||
{
|
||||
if(transactionBegined)
|
||||
QSqlDatabase::database().rollback();
|
||||
|
||||
if(db != nullptr)
|
||||
{
|
||||
if(db->isOpen())
|
||||
@@ -87,7 +90,7 @@ DataBaseSettings DataBaseLMS::getDataBaseSettings()
|
||||
QFile file("config/settings.xml");
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QMessageBox::critical(ownerWidget, "Attention!", "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);
|
||||
|
||||
Reference in New Issue
Block a user