mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Вынес настройки ГУИ в отдельную кнопку
This commit is contained in:
@@ -7,6 +7,9 @@ add_library(InstructorsAndTrainees SHARED
|
||||
instructorsandtraineeswidget.cpp
|
||||
instructorsandtraineeswidget.h
|
||||
instructorsandtraineeswidget.ui
|
||||
dialogsettings.cpp
|
||||
dialogsettings.h
|
||||
dialogsettings.ui
|
||||
commonview.cpp
|
||||
commonview.h
|
||||
|
||||
|
||||
45
InstructorsAndTrainees/dialogsettings.cpp
Normal file
45
InstructorsAndTrainees/dialogsettings.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "dialogsettings.h"
|
||||
#include "ui_dialogsettings.h"
|
||||
|
||||
DialogSettings::DialogSettings(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogSettings)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->btnUpdateStyle->setObjectName("btnUpdateStyle");
|
||||
|
||||
//Задаём два пункта с текстом локалей в комбобоксе
|
||||
ui->cmbLanguage->addItems(QStringList() << "English" << "Русский");
|
||||
}
|
||||
|
||||
DialogSettings::~DialogSettings()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DialogSettings::changeEvent(QEvent *event)
|
||||
{
|
||||
// В случае получения события изменения языка приложения
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{// переведём окно заново
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
}
|
||||
|
||||
void DialogSettings::on_cmbLanguage_currentIndexChanged(const QString &arg1)
|
||||
{
|
||||
QString language;
|
||||
|
||||
if(arg1 == QStringLiteral("English"))
|
||||
language = QString("en_EN");
|
||||
else
|
||||
language = QString("ru_RU");
|
||||
|
||||
emit signal_LanguageChanged(language);
|
||||
}
|
||||
|
||||
void DialogSettings::on_btnUpdateStyle_clicked()
|
||||
{
|
||||
emit signal_UpdateStyleSheet();
|
||||
}
|
||||
39
InstructorsAndTrainees/dialogsettings.h
Normal file
39
InstructorsAndTrainees/dialogsettings.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef DIALOGSETTINGS_H
|
||||
#define DIALOGSETTINGS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTranslator>
|
||||
#include <QEvent>
|
||||
|
||||
namespace Ui {
|
||||
class DialogSettings;
|
||||
}
|
||||
|
||||
class DialogSettings : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogSettings(QWidget *parent = nullptr);
|
||||
~DialogSettings();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent * event) override;
|
||||
|
||||
signals:
|
||||
//сигнал об изменении языка интерфейса
|
||||
void signal_LanguageChanged(QString language);
|
||||
//сигнал об изменении стиля
|
||||
void signal_UpdateStyleSheet();
|
||||
|
||||
private slots:
|
||||
void on_cmbLanguage_currentIndexChanged(const QString &arg1);
|
||||
|
||||
void on_btnUpdateStyle_clicked();
|
||||
|
||||
private:
|
||||
Ui::DialogSettings *ui;
|
||||
QTranslator qtLanguageTranslator;
|
||||
};
|
||||
|
||||
#endif // DIALOGSETTINGS_H
|
||||
113
InstructorsAndTrainees/dialogsettings.ui
Normal file
113
InstructorsAndTrainees/dialogsettings.ui
Normal file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogSettings</class>
|
||||
<widget class="QDialog" name="DialogSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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>
|
||||
<widget class="QComboBox" name="cmbLanguage"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<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>
|
||||
<widget class="QToolButton" name="btnUpdateStyle">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update style</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/resources/icons/style.png</normaloff>:/resources/icons/style.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "instructorsandtraineeswidget.h"
|
||||
#include "ui_instructorsandtraineeswidget.h"
|
||||
#include "dialogauthorizationinstructor.h"
|
||||
#include "dialogsettings.h"
|
||||
|
||||
InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -19,7 +20,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->btnUpdateStyleSheet->setObjectName("btnUpdateStyleSheet");
|
||||
ui->btnSettings->setObjectName("btnSettings");
|
||||
#ifndef PROJECT_TYPE_DEBUG
|
||||
ui->btnUpdateStyleSheet->setVisible(false);
|
||||
#endif
|
||||
@@ -182,7 +183,12 @@ void InstructorsAndTraineesWidget::slot_LanguageChanged(QString language)
|
||||
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTraineesWidget_")) + language, QStringLiteral("."));
|
||||
qApp->installTranslator(&qtLanguageTranslator);
|
||||
|
||||
Q_EMIT signal_LanguageChanged(language);
|
||||
emit signal_LanguageChanged(language);
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::slot_UpdateStyleSheet()
|
||||
{
|
||||
updateMyStyleSheet();
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverAuth)
|
||||
@@ -408,11 +414,6 @@ void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor(QString login,
|
||||
}
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnUpdateStyleSheet_clicked()
|
||||
{
|
||||
updateMyStyleSheet();
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnSetVersion_clicked()
|
||||
{
|
||||
connectorToServer->showVersionSelect();
|
||||
@@ -445,3 +446,24 @@ void InstructorsAndTraineesWidget::on_tabWidget_currentChanged(int index)
|
||||
ui->btnAssignTask->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnSettings_clicked()
|
||||
{
|
||||
DialogSettings dlg(this);
|
||||
|
||||
connect(&dlg, &DialogSettings::signal_LanguageChanged, this, &InstructorsAndTraineesWidget::slot_LanguageChanged);
|
||||
connect(&dlg, &DialogSettings::signal_UpdateStyleSheet, this, &InstructorsAndTraineesWidget::slot_UpdateStyleSheet);
|
||||
|
||||
|
||||
switch( dlg.exec() )
|
||||
{
|
||||
case QDialog::Accepted:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case QDialog::Rejected:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ private:
|
||||
public Q_SLOTS:
|
||||
//Слот обработки смены языка
|
||||
void slot_LanguageChanged(QString language);
|
||||
//Слот обработки смены стиля
|
||||
void slot_UpdateStyleSheet();
|
||||
|
||||
|
||||
//Слот обработки результата авторизации
|
||||
void checkLoginResult(ServerAuthorization * serverAuth);
|
||||
//Слот обработки результата деавторизации
|
||||
@@ -54,7 +58,7 @@ public Q_SLOTS:
|
||||
void slot_currentItemChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
//сигнал об изменении языка интерфейса
|
||||
//Слот смены языка
|
||||
void signal_LanguageChanged(QString language);
|
||||
//сигнал о необходимости обновления интерфейса
|
||||
void signal_NeedUpdateUI(bool treeInstructor, bool treeTrainee);
|
||||
@@ -67,7 +71,6 @@ Q_SIGNALS:
|
||||
private Q_SLOTS:
|
||||
void on_btnConnectionToServer_clicked();
|
||||
void on_btnAuthorizationInstructor_clicked();
|
||||
void on_btnUpdateStyleSheet_clicked();
|
||||
|
||||
void on_btnSetVersion_clicked();
|
||||
|
||||
@@ -75,6 +78,8 @@ private Q_SLOTS:
|
||||
|
||||
void on_tabWidget_currentChanged(int index);
|
||||
|
||||
void on_btnSettings_clicked();
|
||||
|
||||
private:
|
||||
//Авторизация инструктора локальная
|
||||
bool authorizationInstructorDialog(QWidget* parent = nullptr);
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnUpdateStyleSheet">
|
||||
<widget class="QToolButton" name="btnSettings">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
@@ -225,7 +225,20 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update StyleSheet</string>
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/resources/icons/settings.png</normaloff>:/resources/icons/settings.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -47,5 +47,7 @@
|
||||
<file>resources/icons/check.png</file>
|
||||
<file>resources/icons/circleRed.png</file>
|
||||
<file>resources/icons/circleYellow.png</file>
|
||||
<file>resources/icons/settings.png</file>
|
||||
<file>resources/icons/style.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
BIN
InstructorsAndTrainees/resources/icons/settings.png
Normal file
BIN
InstructorsAndTrainees/resources/icons/settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
InstructorsAndTrainees/resources/icons/style.png
Normal file
BIN
InstructorsAndTrainees/resources/icons/style.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
@@ -232,6 +232,19 @@ The status will be set: 'completed'</source>
|
||||
<translation>Залогирован</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DialogSettings</name>
|
||||
<message>
|
||||
<location filename="../dialogsettings.ui" line="14"/>
|
||||
<source>Settings</source>
|
||||
<translation>Настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../dialogsettings.ui" line="24"/>
|
||||
<source>Language</source>
|
||||
<translation>Язык</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>EditorInstructors</name>
|
||||
<message>
|
||||
@@ -613,28 +626,33 @@ Delete it anyway?</source>
|
||||
<translation>Обновить стиль</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="242"/>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="241"/>
|
||||
<source>Settings</source>
|
||||
<translation>Настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="268"/>
|
||||
<source>Tasks</source>
|
||||
<translation>Задачи</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="254"/>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="280"/>
|
||||
<source>AMM</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="264"/>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="290"/>
|
||||
<source>FIM</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="279"/>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="305"/>
|
||||
<source>Assign task</source>
|
||||
<translation>Назначить задачу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.ui" line="116"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="139"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="141"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="239"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="264"/>
|
||||
<source>Authorization Instructor</source>
|
||||
@@ -647,18 +665,18 @@ Delete it anyway?</source>
|
||||
<translation>нет</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="137"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="139"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="207"/>
|
||||
<source>Deauthorization Instructor</source>
|
||||
<translation>Деавторизация инструктора</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="167"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="169"/>
|
||||
<source>Attention!</source>
|
||||
<translation>Внимание!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="167"/>
|
||||
<location filename="../instructorsandtraineeswidget.cpp" line="169"/>
|
||||
<source>The file could not be opened </source>
|
||||
<translation>Файл не может быть открыт </translation>
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user