Retranslate GUI.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-08 17:33:37 +03:00
parent 1dece1e9e5
commit ed38ffef38
22 changed files with 887 additions and 474 deletions

View File

@ -57,7 +57,13 @@ TapeConfigurationPage::TapeConfigurationPage(QWidget *parent)
askPointDeletionCheck(nullptr),
toolBarStyleCheck(nullptr),
systemAuthorValueLabel(nullptr),
systemBookValueLabel(nullptr)
systemBookValueLabel(nullptr),
langGroup(nullptr),
guiLabel(nullptr),
systemLabel(nullptr),
systemAuthorLabel(nullptr),
systemBookLabel(nullptr),
separatorLabel(nullptr)
{
QGroupBox *langGroup = LangGroup();
@ -83,6 +89,10 @@ void TapeConfigurationPage::Apply()
systemChanged = false;
qApp->LoadTranslation();
// Part about measurments will not be updated automatically
qApp->RetranslateTables();
qApp->RetranslateGroups();
}
}
@ -112,11 +122,24 @@ void TapeConfigurationPage::LabelLangChanged()
labelLangChanged = true;
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigurationPage::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *TapeConfigurationPage::LangGroup()
{
QGroupBox *langGroup = new QGroupBox(tr("Language"));
QLabel *guiLabel = new QLabel(tr("GUI language"));
langGroup = new QGroupBox(tr("Language"));
guiLabel = new QLabel(tr("GUI language"));
langCombo = new QComboBox;
QDir dir(qApp->translationsPath());
@ -158,7 +181,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
langLayout->addRow(guiLabel, langCombo);
//-------------------- Pattern making system
QLabel *systemLabel = new QLabel(tr("Pattern making system"));
systemLabel = new QLabel(tr("Pattern making system"));
systemCombo = new QComboBox;
InitPMSystems(systemCombo);
@ -166,29 +189,30 @@ QGroupBox *TapeConfigurationPage::LangGroup()
langLayout->addRow(systemLabel, systemCombo);
//----
QLabel *systemAuthorLabel = new QLabel(tr("Author:"));
systemAuthorValueLabel = new QLabel(qApp->TrVars()->PMSystemAuthor(p0_S));
systemAuthorLabel = new QLabel(tr("Author:"));
systemAuthorValueLabel = new QLabel("");
langLayout->addRow(systemAuthorLabel, systemAuthorValueLabel);
//----
QLabel *systemBookLabel = new QLabel(tr("Book:"));
systemBookValueLabel = new QLabel(qApp->TrVars()->PMSystemBook(p0_S));
systemBookLabel = new QLabel(tr("Book:"));
systemBookValueLabel = new QLabel("");
systemBookValueLabel->setWordWrap(true);
langLayout->addRow(systemBookLabel, systemBookValueLabel);
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&TapeConfigurationPage::SystemChanged);
// set default pattern making system
index = systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode());
if (index != -1)
{
systemCombo->setCurrentIndex(index);
}
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&TapeConfigurationPage::SystemChanged);
//-------------------- Decimal separator setup
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
separatorLabel = new QLabel(tr("Decimal separator parts"));
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
osOptionCheck->setChecked(qApp->TapeSettings()->GetOsSeparator());
@ -269,3 +293,27 @@ void TapeConfigurationPage::InitPMSystems(QComboBox *systemCombo)
systemCombo->addItem(qApp->TrVars()->PMSystemName(p53_S), p53_S);
systemCombo->addItem(qApp->TrVars()->PMSystemName(p54_S), p54_S);
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigurationPage::RetranslateUi()
{
langGroup->setTitle(tr("Language"));
guiLabel->setText(tr("GUI language"));
systemLabel->setText(tr("Pattern making system"));
const int index = systemCombo->currentIndex();
systemCombo->blockSignals(true);
systemCombo->clear();
InitPMSystems(systemCombo);
systemCombo->setCurrentIndex(index);
systemCombo->blockSignals(false);
systemAuthorLabel->setText(tr("Author:"));
systemBookLabel->setText(tr("Book:"));
systemAuthorValueLabel->setText(qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()));
systemBookValueLabel->setText(qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()));
separatorLabel->setText(tr("Decimal separator parts"));
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
}

View File

@ -49,6 +49,8 @@ public slots:
void SystemChanged();
void UnitChanged();
void LabelLangChanged();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(TapeConfigurationPage)
QComboBox *langCombo;
@ -66,9 +68,17 @@ private:
QLabel *systemAuthorValueLabel;
QLabel *systemBookValueLabel;
QGroupBox *langGroup;
QLabel *guiLabel;
QLabel *systemLabel;
QLabel *systemAuthorLabel;
QLabel *systemBookLabel;
QLabel *separatorLabel;
QGroupBox *LangGroup();
void SetLabelComboBox(const QStringList &list);
void InitPMSystems(QComboBox *systemCombo);
void RetranslateUi();
};
#endif // CONFIGURATIONPAGE_H

View File

@ -47,7 +47,11 @@
//---------------------------------------------------------------------------------------------------------------------
TapePathPage::TapePathPage(QWidget *parent)
: QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr)
: QWidget(parent),
defaultButton(nullptr),
editButton(nullptr),
pathTable(nullptr),
pathGroup(nullptr)
{
QGroupBox *pathGroup = PathGroup();
SCASSERT(pathGroup != nullptr);
@ -136,10 +140,23 @@ void TapePathPage::EditPath()
item->setToolTip(dir);
}
//---------------------------------------------------------------------------------------------------------------------
void TapePathPage::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *TapePathPage::PathGroup()
{
QGroupBox *pathGroup = new QGroupBox(tr("Path that use Valentina"));
pathGroup = new QGroupBox(tr("Path that use Valentina"));
InitTable();
defaultButton = new QPushButton(tr("Default"));
@ -174,7 +191,7 @@ void TapePathPage::InitTable()
pathTable->setSelectionMode(QAbstractItemView::SingleSelection);
pathTable->setShowGrid(false);
QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
pathTable->setHorizontalHeaderLabels(tableHeader);
{
@ -205,3 +222,18 @@ void TapePathPage::InitTable()
connect(pathTable, &QTableWidget::itemSelectionChanged, this, &TapePathPage::TableActivated);
}
//---------------------------------------------------------------------------------------------------------------------
void TapePathPage::RetranslateUi()
{
pathGroup->setTitle(tr("Path that use Valentina"));
defaultButton->setText(tr("Default"));
editButton->setText(tr("Edit"));
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
pathTable->setHorizontalHeaderLabels(tableHeader);
pathTable->item(0, 0)->setText(tr("Individual measurements"));
pathTable->item(1, 0)->setText(tr("Standard measurements"));
pathTable->item(2, 0)->setText(tr("Templates"));
}

View File

@ -46,13 +46,18 @@ public slots:
void TableActivated();
void DefaultPath();
void EditPath();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(TapePathPage)
QPushButton *defaultButton;
QPushButton *editButton;
QTableWidget *pathTable;
QGroupBox *pathGroup;
QGroupBox *PathGroup();
void InitTable();
void RetranslateUi();
};
#endif // PATHPAGE_H

View File

@ -31,6 +31,7 @@
#include "../version.h"
#include "../vmisc/def.h"
#include <QDate>
#include <QDesktopServices>
#include <QMessageBox>
@ -43,21 +44,7 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->label_Tape_Version->setText(QString("Tape %1").arg(APP_VERSION_STR));
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(BUILD_REVISION));
ui->label_QT_Version->setText(buildCompatibilityString());
QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
ui->label_Tape_Built->setText(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__));
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
"The program is provided AS IS with NO WARRANTY OF ANY "
"KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY "
"AND FITNESS FOR A PARTICULAR PURPOSE."));
ui->pushButton_Web_Site->setText(tr("Web site : %1")
.arg(VER_COMPANYDOMAIN_STR));
RetranslateUi();
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, &DialogAboutTape::WebButtonClicked);
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
@ -77,6 +64,20 @@ DialogAboutTape::~DialogAboutTape()
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAboutTape::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
RetranslateUi();
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAboutTape::WebButtonClicked()
{
@ -95,3 +96,21 @@ void DialogAboutTape::FontPointSize(QWidget *w, int pointSize)
font.setPointSize(pointSize);
w->setFont(font);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAboutTape::RetranslateUi()
{
ui->label_Tape_Version->setText(QString("Tape %1").arg(APP_VERSION_STR));
ui->labelBuildRevision->setText(tr("Build revision: %1").arg(BUILD_REVISION));
ui->label_QT_Version->setText(buildCompatibilityString());
const QDate date = QLocale(QLocale::C).toDate(QString(__DATE__).simplified(), QLatin1String("MMM d yyyy"));
ui->label_Tape_Built->setText(tr("Built on %3 at %4").arg(date.toString()).arg(__TIME__));
ui->label_Legal_Stuff->setText(QApplication::translate("InternalStrings",
"The program is provided AS IS with NO WARRANTY OF ANY "
"KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY "
"AND FITNESS FOR A PARTICULAR PURPOSE."));
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR));
}

View File

@ -43,6 +43,9 @@ public:
explicit DialogAboutTape(QWidget *parent = 0);
~DialogAboutTape();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private slots:
void WebButtonClicked();
@ -51,6 +54,8 @@ private:
Ui::DialogAboutTape *ui;
void FontPointSize(QWidget *w, int pointSize);
void RetranslateUi();
};
#endif // DIALOGABOUTTAPE_H

View File

@ -35,7 +35,24 @@ DialogMDataBase::DialogMDataBase(const QStringList &list, QWidget *parent)
:QDialog(parent),
ui(new Ui::DialogMDataBase),
selectMode(true),
list(list)
list(list),
groupA(nullptr),
groupB(nullptr),
groupC(nullptr),
groupD(nullptr),
groupE(nullptr),
groupF(nullptr),
groupG(nullptr),
groupH(nullptr),
groupI(nullptr),
groupJ(nullptr),
groupK(nullptr),
groupL(nullptr),
groupM(nullptr),
groupN(nullptr),
groupO(nullptr),
groupP(nullptr),
groupQ(nullptr)
{
ui->setupUi(this);
InitDataBase(list);
@ -51,7 +68,24 @@ DialogMDataBase::DialogMDataBase(QWidget *parent)
:QDialog(parent),
ui(new Ui::DialogMDataBase),
selectMode(false),
list()
list(),
groupA(nullptr),
groupB(nullptr),
groupC(nullptr),
groupD(nullptr),
groupE(nullptr),
groupF(nullptr),
groupG(nullptr),
groupH(nullptr),
groupI(nullptr),
groupJ(nullptr),
groupK(nullptr),
groupL(nullptr),
groupM(nullptr),
groupN(nullptr),
groupO(nullptr),
groupP(nullptr),
groupQ(nullptr)
{
ui->setupUi(this);
@ -94,6 +128,43 @@ QStringList DialogMDataBase::GetNewNames() const
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::RetranslateGroups()
{
RetranslateGroup(groupA, "A. " + tr("Direct Height", "Measurement section"), ListGroupA());
RetranslateGroup(groupB, "B. " + tr("Direct Width", "Measurement section"), ListGroupB());
RetranslateGroup(groupC, "C. " + tr("Indentation", "Measurement section"), ListGroupC());
RetranslateGroup(groupD, "D. " + tr("Circumference and Arc", "Measurement section"), ListGroupD());
RetranslateGroup(groupE, "E. " + tr("Vertical", "Measurement section"), ListGroupE());
RetranslateGroup(groupF, "F. " + tr("Horizontal", "Measurement section"), ListGroupF());
RetranslateGroup(groupG, "G. " + tr("Bust", "Measurement section"), ListGroupG());
RetranslateGroup(groupH, "H. " + tr("Balance", "Measurement section"), ListGroupH());
RetranslateGroup(groupI, "I. " + tr("Arm", "Measurement section"), ListGroupI());
RetranslateGroup(groupJ, "J. " + tr("Leg", "Measurement section"), ListGroupJ());
RetranslateGroup(groupK, "K. " + tr("Crotch and Rise", "Measurement section"), ListGroupK());
RetranslateGroup(groupL, "L. " + tr("Hand", "Measurement section"), ListGroupL());
RetranslateGroup(groupM, "M. " + tr("Foot", "Measurement section"), ListGroupM());
RetranslateGroup(groupN, "N. " + tr("Head", "Measurement section"), ListGroupN());
RetranslateGroup(groupO, "O. " + tr("Men & Tailoring", "Measurement section"), ListGroupO());
RetranslateGroup(groupP, "P. " + tr("Historical & Specialty", "Measurement section"), ListGroupP());
RetranslateGroup(groupQ, "Q. " + tr("Patternmaking measurements", "Measurement section"), ListGroupQ());
ShowDescription(ui->treeWidget->currentIndex(), 0);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::UpdateChecks(QTreeWidgetItem *item, int column)
{
@ -160,6 +231,12 @@ void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
return;
}
if (item == nullptr)
{
ui->textEdit->clear();
return;
}
if (item->childCount() != 0)
{
ui->textEdit->clear();
@ -186,426 +263,57 @@ void DialogMDataBase::ShowDescription(QTreeWidgetItem *item, int column)
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitDataBase(const QStringList &list)
{
InitGroupA(list);
InitGroupB(list);
InitGroupC(list);
InitGroupD(list);
InitGroupE(list);
InitGroupF(list);
InitGroupG(list);
InitGroupH(list);
InitGroupI(list);
InitGroupJ(list);
InitGroupK(list);
InitGroupL(list);
InitGroupM(list);
InitGroupN(list);
InitGroupO(list);
InitGroupP(list);
InitGroupQ(list);
InitGroup(groupA, "A. " + tr("Direct Height", "Measurement section"), ListGroupA(), list);
InitGroup(groupB, "B. " + tr("Direct Width", "Measurement section"), ListGroupB(), list);
InitGroup(groupC, "C. " + tr("Indentation", "Measurement section"), ListGroupC(), list);
InitGroup(groupD, "D. " + tr("Circumference and Arc", "Measurement section"), ListGroupD(), list);
InitGroup(groupE, "E. " + tr("Vertical", "Measurement section"), ListGroupE(), list);
InitGroup(groupF, "F. " + tr("Horizontal", "Measurement section"), ListGroupF(), list);
InitGroup(groupG, "G. " + tr("Bust", "Measurement section"), ListGroupG(), list);
InitGroup(groupH, "H. " + tr("Balance", "Measurement section"), ListGroupH(), list);
InitGroup(groupI, "I. " + tr("Arm", "Measurement section"), ListGroupI(), list);
InitGroup(groupJ, "J. " + tr("Leg", "Measurement section"), ListGroupJ(), list);
InitGroup(groupK, "K. " + tr("Crotch and Rise", "Measurement section"), ListGroupK(), list);
InitGroup(groupL, "L. " + tr("Hand", "Measurement section"), ListGroupL(), list);
InitGroup(groupM, "M. " + tr("Foot", "Measurement section"), ListGroupM(), list);
InitGroup(groupN, "N. " + tr("Head", "Measurement section"), ListGroupN(), list);
InitGroup(groupO, "O. " + tr("Men & Tailoring", "Measurement section"), ListGroupO(), list);
InitGroup(groupP, "P. " + tr("Historical & Specialty", "Measurement section"), ListGroupP(), list);
InitGroup(groupQ, "Q. " + tr("Patternmaking measurements", "Measurement section"), ListGroupQ(), list);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitDataBase()
{
InitGroupA();
InitGroupB();
InitGroupC();
InitGroupD();
InitGroupE();
InitGroupF();
InitGroupG();
InitGroupH();
InitGroupI();
InitGroupJ();
InitGroupK();
InitGroupL();
InitGroupM();
InitGroupN();
InitGroupO();
InitGroupP();
InitGroupQ();
InitGroup(groupA, "A. " + tr("Direct Height", "Measurement section"), ListGroupA());
InitGroup(groupB, "B. " + tr("Direct Width", "Measurement section"), ListGroupB());
InitGroup(groupC, "C. " + tr("Indentation", "Measurement section"), ListGroupC());
InitGroup(groupD, "D. " + tr("Circumference and Arc", "Measurement section"), ListGroupD());
InitGroup(groupE, "E. " + tr("Vertical", "Measurement section"), ListGroupE());
InitGroup(groupF, "F. " + tr("Horizontal", "Measurement section"), ListGroupF());
InitGroup(groupG, "G. " + tr("Bust", "Measurement section"), ListGroupG());
InitGroup(groupH, "H. " + tr("Balance", "Measurement section"), ListGroupH());
InitGroup(groupI, "I. " + tr("Arm", "Measurement section"), ListGroupI());
InitGroup(groupJ, "J. " + tr("Leg", "Measurement section"), ListGroupJ());
InitGroup(groupK, "K. " + tr("Crotch and Rise", "Measurement section"), ListGroupK());
InitGroup(groupL, "L. " + tr("Hand", "Measurement section"), ListGroupL());
InitGroup(groupM, "M. " + tr("Foot", "Measurement section"), ListGroupM());
InitGroup(groupN, "N. " + tr("Head", "Measurement section"), ListGroupN());
InitGroup(groupO, "O. " + tr("Men & Tailoring", "Measurement section"), ListGroupO());
InitGroup(groupP, "P. " + tr("Historical & Specialty", "Measurement section"), ListGroupP());
InitGroup(groupQ, "Q. " + tr("Patternmaking measurements", "Measurement section"), ListGroupQ());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupA(const QStringList &list)
void DialogMDataBase::InitGroup(QTreeWidgetItem *group, const QString &groupName, const QStringList &mList,
const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("A. " + tr("Direct Height", "Measurement section"));
group = AddGroup(groupName);
AddMeasurement(group, height_M, list); // A01
AddMeasurement(group, heightNeckBack_M, list); // A02
AddMeasurement(group, heightScapula_M, list); // A03
AddMeasurement(group, heightArmpit_M, list); // A04
AddMeasurement(group, heightWaistSide_M, list); // A05
AddMeasurement(group, heightHip_M, list); // A06
AddMeasurement(group, heightGlutealFold_M, list); // A07
AddMeasurement(group, heightKnee_M, list); // A08
AddMeasurement(group, heightCalf_M, list); // A09
AddMeasurement(group, heightAnkleHigh_M, list); // A10
AddMeasurement(group, heightAnkle_M, list); // A11
AddMeasurement(group, heightHighhip_M, list); // A12
AddMeasurement(group, heightWaistFront_M, list); // A13
AddMeasurement(group, heightBustpoint_M, list); // A14
AddMeasurement(group, heightShoulderTip_M, list); // A15
AddMeasurement(group, heightNeckFront_M, list); // A16
AddMeasurement(group, heightNeckSide_M, list); // A17
AddMeasurement(group, heightNeckBackToKnee_M, list); // A18
AddMeasurement(group, heightWaistSideToKnee_M, list); // A19
AddMeasurement(group, heightWaistSideToHip_M, list); // A20
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupB(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("B. " + tr("Direct Width", "Measurement section"));
AddMeasurement(group, widthShoulder_M, list); // B01
AddMeasurement(group, widthBust_M, list); // B02
AddMeasurement(group, widthWaist_M, list); // B03
AddMeasurement(group, widthHip_M, list); // B04
AddMeasurement(group, widthAbdomenToHip_M, list); // B05
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupC(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("C. " + tr("Indentation", "Measurement section"));
AddMeasurement(group, indentNeckBack_M, list); // C01
AddMeasurement(group, indentWaistBack_M, list); // C02
AddMeasurement(group, indentAnkleHigh_M, list); // C03
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupD(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("D. " + tr("Circumference and Arc", "Measurement section"));
AddMeasurement(group, neckMidCirc_M, list); // D01
AddMeasurement(group, neckCirc_M, list); // D02
AddMeasurement(group, highbustCirc_M, list); // D03
AddMeasurement(group, bustCirc_M, list); // D04
AddMeasurement(group, lowbustCirc_M, list); // D05
AddMeasurement(group, ribCirc_M, list); // D06
AddMeasurement(group, waistCirc_M, list); // D07
AddMeasurement(group, highhipCirc_M, list); // D08
AddMeasurement(group, hipCirc_M, list); // D09
AddMeasurement(group, neckArcF_M, list); // D10
AddMeasurement(group, highbustArcF_M, list); // D11
AddMeasurement(group, bustArcF_M, list); // D12
AddMeasurement(group, lowbustArcF_M, list); // D13
AddMeasurement(group, ribArcF_M, list); // D14
AddMeasurement(group, waistArcF_M, list); // D15
AddMeasurement(group, highhipArcF_M, list); // D16
AddMeasurement(group, hipArcF_M, list); // D17
AddMeasurement(group, neckArcB_M, list); // D18
AddMeasurement(group, highbustArcB_M, list); // D19
AddMeasurement(group, bustArcB_M, list); // D20
AddMeasurement(group, lowbustArcB_M, list); // D21
AddMeasurement(group, ribArcB_M, list); // D22
AddMeasurement(group, waistArcB_M, list); // D23
AddMeasurement(group, highhipArcB_M, list); // D24
AddMeasurement(group, hipArcB_M, list); // D25
AddMeasurement(group, neckArcHalfF_M, list); // D26
AddMeasurement(group, highbustArcHalfF_M, list); // D27
AddMeasurement(group, bustArcHalfF_M, list); // D28
AddMeasurement(group, lowbustArcHalfF_M, list); // D29
AddMeasurement(group, ribArcHalfF_M, list); // D30
AddMeasurement(group, waistArcHalfF_M, list); // D31
AddMeasurement(group, highhipArcHalfF_M, list); // D32
AddMeasurement(group, hipArcHalfF_M, list); // D33
AddMeasurement(group, neckArcHalfB_M, list); // D34
AddMeasurement(group, highbustArcHalfB_M, list); // D35
AddMeasurement(group, bustArcHalfB_M, list); // D36
AddMeasurement(group, lowbustArcHalfB_M, list); // D37
AddMeasurement(group, ribArcHalfB_M, list); // D38
AddMeasurement(group, waistArcHalfB_M, list); // D39
AddMeasurement(group, highhipArcHalfB_M, list); // D40
AddMeasurement(group, hipArcHalfB_M, list); // D41
AddMeasurement(group, hipWithAbdomenArcF_M, list); // D42
AddMeasurement(group, bodyArmfoldCirc_M, list); // D43
AddMeasurement(group, bodyBustCirc_M, list); // D44
AddMeasurement(group, bodyTorsoCirc_M, list); // D45
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupE(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("E. " + tr("Vertical", "Measurement section"));
AddMeasurement(group, neckFrontToWaistF_M, list); // E01
AddMeasurement(group, neckFrontToWaistFlatF_M, list); // E02
AddMeasurement(group, armpitToWaistSide_M, list); // E03
AddMeasurement(group, shoulderTipToWaistSideF_M, list); // E04
AddMeasurement(group, neckSideToWaistF_M, list); // E05
AddMeasurement(group, neckSideToWaistBustpointF_M, list); // E06
AddMeasurement(group, shoulderTipToWaistSideB_M, list); // E07
AddMeasurement(group, neckSideToWaistB_M, list); // E08
AddMeasurement(group, neckBackToWaistB_M, list); // E09
AddMeasurement(group, neckSideToWaistBladepointB_M, list); // E10
AddMeasurement(group, shoulderTipToArmfoldF_M, list); // E11
AddMeasurement(group, neckSideToBustF_M, list); // E12
AddMeasurement(group, neckSideToHighbustF_M, list); // E13
AddMeasurement(group, shoulderCenterToHighbustF_M, list); // E14
AddMeasurement(group, neckFrontToHighbustF_M, list); // E15
AddMeasurement(group, neckFrontToBustF_M, list); // E16
AddMeasurement(group, lowbustToWaistF_M, list); // E17
AddMeasurement(group, shoulderTipToArmfoldB_M, list); // E18
AddMeasurement(group, neckSideToBustB_M, list); // E19
AddMeasurement(group, neckSideToHighbustB_M, list); // E20
AddMeasurement(group, shoulderCenterToHighbustB_M, list); // E21
AddMeasurement(group, neckBackToHighbustB_M, list); // E22
AddMeasurement(group, neckBackToBustB_M, list); // E23
AddMeasurement(group, lowbustToWaistB_M, list); // E24
AddMeasurement(group, waistToHighhipF_M, list); // E25
AddMeasurement(group, waistToHipF_M, list); // E26
AddMeasurement(group, waistToHighhipSide_M, list); // E27
AddMeasurement(group, waistToHighhipB_M, list); // E28
AddMeasurement(group, waistToHipB_M, list); // E29
AddMeasurement(group, waistToHipSide_M, list); // E30
AddMeasurement(group, shoulderSlopeNeckSideLength_M, list); // E31
AddMeasurement(group, shoulderSlopeNeckSideAngle_M, list); // E32
AddMeasurement(group, shoulderSlopeNeckBackHeight_M, list); // E33
AddMeasurement(group, shoulderSlopeNeckBackAngle_M, list); // E34
AddMeasurement(group, shoulderSlopeShoulderTipAngle_M, list); // E35
AddMeasurement(group, highbustToWaistF_M, list); // E36
AddMeasurement(group, highbustToWaistB_M, list); // E37
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupF(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("F." + tr("Horizontal", "Measurement section"));
AddMeasurement(group, shoulderLength_M, list); // F01
AddMeasurement(group, shoulderWidthF_M, list); // F02
AddMeasurement(group, acrossChestF_M, list); // F03
AddMeasurement(group, armfoldToArmfoldF_M, list); // F04
AddMeasurement(group, shoulderWidthB_M, list); // F05
AddMeasurement(group, acrossBackB_M, list); // F06
AddMeasurement(group, armfoldToArmfoldB_M, list); // F07
AddMeasurement(group, shoulderTipToShoulderTipHalfF_M, list); // F08
AddMeasurement(group, acrossChestHalfF_M, list); // F09
AddMeasurement(group, shoulderTipToShoulderTipHalfB_M, list); // F10
AddMeasurement(group, acrossBackHalfB_M, list); // F11
AddMeasurement(group, neckFrontToShoulderTipF_M, list); // F12
AddMeasurement(group, neckBackToShoulderTipB_M, list); // F13
AddMeasurement(group, neckWidth_M, list); // F14
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupG(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("G. " + tr("Bust", "Measurement section"));
AddMeasurement(group, bustpointToBustpoint_M, list); // G01
AddMeasurement(group, bustpointToNeckSide_M, list); // G02
AddMeasurement(group, bustpointToLowbust_M, list); // G03
AddMeasurement(group, bustpointToWaist_M, list); // G04
AddMeasurement(group, bustpointToBustpointHalf_M, list); // G05
AddMeasurement(group, bustpointToBustpointHalter_M, list); // G06
AddMeasurement(group, bustpointToShoulderTip_M, list); // G07
AddMeasurement(group, bustpointToWaistFront_M, list); // G08
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupH(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("H. " + tr("Balance", "Measurement section"));
AddMeasurement(group, shoulderTipToWaistFront_M, list); // H01
AddMeasurement(group, neckFrontToWaistSide_M, list); // H02
AddMeasurement(group, neckSideToWaistSideF_M, list); // H03
AddMeasurement(group, neckSideToArmfoldF_M, list); // H04
AddMeasurement(group, neckSideToArmpitF_M, list); // H05
AddMeasurement(group, neckSideToBustSideF_M, list); // H06
AddMeasurement(group, shoulderTipToWaistBack_M, list); // H07
AddMeasurement(group, neckBackToWaistSide_M, list); // H08
AddMeasurement(group, neckSideToWaistSideB_M, list); // H09
AddMeasurement(group, neckSideToArmfoldB_M, list); // H10
AddMeasurement(group, neckSideToArmpitB_M, list); // H11
AddMeasurement(group, neckSideToBustSideB_M, list); // H12
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupI(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("I. " + tr("Arm", "Measurement section"));
AddMeasurement(group, armShoulderTipToWristBent_M, list); // I01
AddMeasurement(group, armShoulderTipToElbowBent_M, list); // I02
AddMeasurement(group, armElbowToWristBent_M, list); // I03
AddMeasurement(group, armElbowCircBent_M, list); // I04
AddMeasurement(group, armShoulderTipToWrist_M, list); // I05
AddMeasurement(group, armShoulderTipToElbow_M, list); // I06
AddMeasurement(group, armElbowToWrist_M, list); // I07
AddMeasurement(group, armArmpitToWrist_M, list); // I08
AddMeasurement(group, armArmpitToElbow_M, list); // I09
AddMeasurement(group, armElbowToWristInside_M, list); // I10
AddMeasurement(group, armUpperCirc_M, list); // I11
AddMeasurement(group, armAboveElbowCirc_M, list); // I12
AddMeasurement(group, armElbowCirc_M, list); // I13
AddMeasurement(group, armLowerCirc_M, list); // I14
AddMeasurement(group, armWristCirc_M, list); // I15
AddMeasurement(group, armShoulderTipToArmfoldLine_M, list); // I16
AddMeasurement(group, armscyeCirc_M, list); // I17
AddMeasurement(group, armscyeLength_M, list); // I18
AddMeasurement(group, armscyeWidth_M, list); // I19
AddMeasurement(group, armNeckSideToFingerTip_M, list); // I20
AddMeasurement(group, armNeckSideToWrist_M, list); // I21
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupJ(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("J. " + tr("Leg", "Measurement section"));
AddMeasurement(group, legCrotchToFloor_M, list); // J01
AddMeasurement(group, legWaistSideToFloor_M, list); // J02
AddMeasurement(group, legWaistSideToKnee_M, list); // J03
AddMeasurement(group, legThighUpperCirc_M, list); // J04
AddMeasurement(group, legThighMidCirc_M, list); // J05
AddMeasurement(group, legKneeCirc_M, list); // J06
AddMeasurement(group, legKneeSmallCirc_M, list); // J07
AddMeasurement(group, legCalfCirc_M, list); // J08
AddMeasurement(group, legAnkleHighCirc_M, list); // J09
AddMeasurement(group, legAnkleCirc_M, list); // J10
AddMeasurement(group, legKneeCircBent_M, list); // J11
AddMeasurement(group, legAnkleDiagCirc_M, list); // J12
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupK(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("K. " + tr("Crotch and Rise", "Measurement section"));
AddMeasurement(group, crotchLength_M, list); // K01
AddMeasurement(group, crotchLengthB_M, list); // K02
AddMeasurement(group, crotchLengthF_M, list); // K03
AddMeasurement(group, riseLengthSide_M, list); // K04
AddMeasurement(group, riseLengthDiag_M, list); // K05
AddMeasurement(group, riseLengthB_M, list); // K06
AddMeasurement(group, riseLengthF_M, list); // K07
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupL(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("L. " + tr("Hand", "Measurement section"));
AddMeasurement(group, handPalmLength_M, list); // L01
AddMeasurement(group, handLength_M, list); // L02
AddMeasurement(group, handPalmWidth_M, list); // L03
AddMeasurement(group, handPalmCirc_M, list); // L04
AddMeasurement(group, handCirc_M, list); // L05
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupM(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("M. " + tr("Foot", "Measurement section"));
AddMeasurement(group, footWidth_M, list); // M01
AddMeasurement(group, footLength_M, list); // M02
AddMeasurement(group, footCirc_M, list); // M03
AddMeasurement(group, footInstepCirc_M, list); // M04
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupN(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("N. " + tr("Head", "Measurement section"));
AddMeasurement(group, headCirc_M, list); // N01
AddMeasurement(group, headLength_M, list); // N02
AddMeasurement(group, headDepth_M, list); // N03
AddMeasurement(group, headWidth_M, list); // N04
AddMeasurement(group, headCrownToNeckBack_M, list); // N05
AddMeasurement(group, headChinToNeckBack_M, list); // N06
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupO(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("O. " + tr("Men & Tailoring", "Measurement section"));
AddMeasurement(group, neckBackToWaistFront_M, list); // O01
AddMeasurement(group, waistToWaistHalter_M, list); // O02
AddMeasurement(group, waistNaturalCirc_M, list); // O03
AddMeasurement(group, waistNaturalArcF_M, list); // O04
AddMeasurement(group, waistNaturalArcB_M, list); // O05
AddMeasurement(group, waistToNaturalWaistF_M, list); // O06
AddMeasurement(group, waistToNaturalWaistB_M, list); // O07
AddMeasurement(group, armNeckBackToElbowBent_M, list); // O08
AddMeasurement(group, armNeckBackToWristBent_M, list); // O09
AddMeasurement(group, armNeckSideToElbowBent_M, list); // O10
AddMeasurement(group, armNeckSideToWristBent_M, list); // O11
AddMeasurement(group, armAcrossBackCenterToElbowBent_M, list); // O12
AddMeasurement(group, armAcrossBackCenterToWristBent_M, list); // O13
AddMeasurement(group, armArmscyeBackCenterToWristBent_M, list); // O14
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupP(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("P. " + tr("Historical & Specialty", "Measurement section"));
AddMeasurement(group, armfoldToArmfoldBust_M, list); // P01
AddMeasurement(group, armfoldToBustFront_M, list); // P02
AddMeasurement(group, neckBackToBustFront_M, list); // P03
AddMeasurement(group, neckBackToArmfoldFront_M, list); // P04
AddMeasurement(group, neckBackToArmfoldFrontToWaistSide_M, list); // P05
AddMeasurement(group, highbustBackOverShoulderToArmfoldFront_M, list); // P06
AddMeasurement(group, highbustBackOverShoulderToWaistFront_M, list); // P07
AddMeasurement(group, neckBackToArmfoldFrontToNeckBack_M, list); // P08
AddMeasurement(group, acrossBackCenterToArmfoldFrontToAcrossBackCenter_M, list); // P09
AddMeasurement(group, neckBackToArmfoldFrontToHighbustBack_M, list); // P10
AddMeasurement(group, highbustBOverShoulderToHighbustF_M, list); // P11
AddMeasurement(group, armscyeArc_M, list); // P12
ui->treeWidget->setItemExpanded(group, true);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::InitGroupQ(const QStringList &list)
{
QTreeWidgetItem *group = AddGroup("Q. " + tr("Patternmaking measurements", "Measurement section"));
AddMeasurement(group, dartWidthShoulder_M, list); // Q01
AddMeasurement(group, dartWidthBust_M, list); // Q02
AddMeasurement(group, dartWidthWaist_M, list); // Q03
ui->treeWidget->setItemExpanded(group, true);
for (int i=0; i < mList.size(); ++i)
{
AddMeasurement(group, mList.at(i), list);
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -1527,3 +1235,25 @@ void DialogMDataBase::WriteSettings()
{
qApp->TapeSettings()->SetDataBaseGeometry(saveGeometry());
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::RetranslateGroup(QTreeWidgetItem *group, const QString &groupText, const QStringList &list)
{
group->setText(0, groupText);
group->setToolTip(0, groupText);
for (int i=0; i<list.size(); ++i)
{
RetranslateMeasurement(group, i, list.at(i));
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogMDataBase::RetranslateMeasurement(QTreeWidgetItem *group, int index, const QString &name)
{
const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
QTreeWidgetItem *m = group->child(index);
m->setText(0, text);
m->setToolTip(0, text);
}

View File

@ -49,6 +49,11 @@ public:
QStringList GetNewNames() const;
void RetranslateGroups();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private slots:
void UpdateChecks(QTreeWidgetItem *item, int column);
void ShowDescription(QTreeWidgetItem *item, int column);
@ -59,26 +64,28 @@ private:
bool selectMode;
QStringList list;
QTreeWidgetItem *groupA;
QTreeWidgetItem *groupB;
QTreeWidgetItem *groupC;
QTreeWidgetItem *groupD;
QTreeWidgetItem *groupE;
QTreeWidgetItem *groupF;
QTreeWidgetItem *groupG;
QTreeWidgetItem *groupH;
QTreeWidgetItem *groupI;
QTreeWidgetItem *groupJ;
QTreeWidgetItem *groupK;
QTreeWidgetItem *groupL;
QTreeWidgetItem *groupM;
QTreeWidgetItem *groupN;
QTreeWidgetItem *groupO;
QTreeWidgetItem *groupP;
QTreeWidgetItem *groupQ;
void InitDataBase(const QStringList &list);
void InitDataBase();
void InitGroupA(const QStringList &list = QStringList());
void InitGroupB(const QStringList &list = QStringList());
void InitGroupC(const QStringList &list = QStringList());
void InitGroupD(const QStringList &list = QStringList());
void InitGroupE(const QStringList &list = QStringList());
void InitGroupF(const QStringList &list = QStringList());
void InitGroupG(const QStringList &list = QStringList());
void InitGroupH(const QStringList &list = QStringList());
void InitGroupI(const QStringList &list = QStringList());
void InitGroupJ(const QStringList &list = QStringList());
void InitGroupK(const QStringList &list = QStringList());
void InitGroupL(const QStringList &list = QStringList());
void InitGroupM(const QStringList &list = QStringList());
void InitGroupN(const QStringList &list = QStringList());
void InitGroupO(const QStringList &list = QStringList());
void InitGroupP(const QStringList &list = QStringList());
void InitGroupQ(const QStringList &list = QStringList());
void InitGroup(QTreeWidgetItem *group, const QString &groupName, const QStringList &mList,
const QStringList &list = QStringList());
QTreeWidgetItem *AddGroup(const QString &text);
void AddMeasurement(QTreeWidgetItem *group, const QString &name, const QStringList &list);
@ -87,6 +94,9 @@ private:
void ReadSettings();
void WriteSettings();
void RetranslateGroup(QTreeWidgetItem *group, const QString &groupText, const QStringList &list);
void RetranslateMeasurement(QTreeWidgetItem *group, int index, const QString &name);
};
#endif // DIALOGMDATABASE_H

View File

@ -85,6 +85,22 @@ int DialogNewMeasurements::BaseHeight() const
return ui->comboBoxBaseHeight->currentText().toInt();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogNewMeasurements::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
InitMTypes();
const MeasurementsType type = static_cast<MeasurementsType>(ui->comboBoxMType->currentData().toInt());
InitUnits(type);
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogNewMeasurements::CurrentTypeChanged(int index)
{
@ -113,11 +129,23 @@ void DialogNewMeasurements::CurrentUnitChanged(int index)
//---------------------------------------------------------------------------------------------------------------------
void DialogNewMeasurements::InitMTypes()
{
int val;
if (ui->comboBoxMType->currentIndex() != -1)
{
val = ui->comboBoxMType->currentData().toInt();
}
ui->comboBoxMType->blockSignals(true);
ui->comboBoxMType->clear();
ui->comboBoxMType->addItem(tr("Individual"), static_cast<int>(MeasurementsType::Individual));
ui->comboBoxMType->addItem(tr("Standard"), static_cast<int>(MeasurementsType::Standard));
ui->comboBoxMType->blockSignals(false);
int index = ui->comboBoxMType->findData(val);
if (index != -1)
{
ui->comboBoxMType->setCurrentIndex(index);
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -149,12 +177,12 @@ void DialogNewMeasurements::InitSizesList()
void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
{
int val;
if (ui->comboBoxMType->currentIndex() != -1)
if (ui->comboBoxUnit->currentIndex() != -1)
{
val = ui->comboBoxMType->currentData().toInt();
val = ui->comboBoxUnit->currentData().toInt();
}
ui->comboBoxMType->blockSignals(true);
ui->comboBoxUnit->blockSignals(true);
ui->comboBoxUnit->clear();
ui->comboBoxUnit->addItem(tr("Centimeters"), static_cast<int>(Unit::Cm));
ui->comboBoxUnit->addItem(tr("Millimiters"), static_cast<int>(Unit::Mm));
@ -162,7 +190,7 @@ void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
{
ui->comboBoxUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
}
ui->comboBoxMType->blockSignals(false);
ui->comboBoxUnit->blockSignals(false);
int index = ui->comboBoxUnit->findData(val);
if (index != -1)

View File

@ -51,6 +51,9 @@ public:
int BaseSize() const;
int BaseHeight() const;
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private slots:
void CurrentTypeChanged(int index);
void CurrentUnitChanged(int index);

View File

@ -41,7 +41,10 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
contentsWidget(nullptr),
pagesWidget(nullptr),
configurationPage(nullptr),
pathPage(nullptr)
pathPage(nullptr),
applyButton(nullptr),
canselButton(nullptr),
okButton(nullptr)
{
contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode);
@ -64,6 +67,7 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
QPushButton *okButton = new QPushButton(tr("&Ok"));
createIcons();
connect(contentsWidget, &QListWidget::currentItemChanged, this, &TapeConfigDialog::changePage);
contentsWidget->setCurrentRow(0);
connect(canselButton, &QPushButton::clicked, this, &TapeConfigDialog::close);
@ -112,13 +116,24 @@ void TapeConfigDialog::closeEvent(QCloseEvent *event)
event->accept();
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigDialog::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigDialog::createIcons()
{
createIcon("://icon/config.png", tr("Configuration"));
createIcon("://icon/path_config.png", tr("Paths"));
connect(contentsWidget, &QListWidget::currentItemChanged, this, &TapeConfigDialog::changePage);
}
//---------------------------------------------------------------------------------------------------------------------
@ -156,3 +171,14 @@ void TapeConfigDialog::Ok()
Apply();
done(QDialog::Accepted);
}
//---------------------------------------------------------------------------------------------------------------------
void TapeConfigDialog::RetranslateUi()
{
applyButton->setText(tr("Apply"));
canselButton->setText(tr("&Cancel"));
okButton->setText(tr("&Ok"));
setWindowTitle(tr("Config Dialog"));
contentsWidget->item(0)->setText(tr("Configuration"));
contentsWidget->item(1)->setText(tr("Paths"));
}

View File

@ -48,17 +48,23 @@ signals:
void UpdateProperties();
protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(TapeConfigDialog)
QListWidget *contentsWidget;
QStackedWidget *pagesWidget;
TapeConfigurationPage *configurationPage;
TapePathPage *pathPage;
QPushButton *applyButton;
QPushButton *canselButton;
QPushButton *okButton;
void createIcons();
void createIcon(const QString &icon, const QString &text);
void Apply();
void Ok();
void RetranslateUi();
};
#endif // CONFIGDIALOG_H

View File

@ -44,7 +44,11 @@ MApplication::MApplication(int &argc, char **argv)
mainWindows(),
localServer(nullptr),
trVars(nullptr),
dataBase(QPointer<DialogMDataBase>())
dataBase(QPointer<DialogMDataBase>()),
qtTranslator(nullptr),
qtxmlTranslator(nullptr),
appTranslator(nullptr),
pmsTranslator(nullptr)
{
setApplicationDisplayName(VER_PRODUCTNAME_STR);
setApplicationName(VER_INTERNALNAME_STR);
@ -167,7 +171,9 @@ void MApplication::LoadTranslation()
const QString checkedLocale = TapeSettings()->GetLocale();
qDebug()<<"Checked locale:"<<checkedLocale;
QTranslator *qtTranslator = new QTranslator(this);
ClearTranslation();
qtTranslator = new QTranslator(this);
#if defined(Q_OS_WIN)
qtTranslator->load("qt_" + checkedLocale, translationsPath());
#else
@ -175,7 +181,7 @@ void MApplication::LoadTranslation()
#endif
installTranslator(qtTranslator);
QTranslator *qtxmlTranslator = new QTranslator(this);
qtxmlTranslator = new QTranslator(this);
#if defined(Q_OS_WIN)
qtxmlTranslator->load("qtxmlpatterns_" + checkedLocale, translationsPath());
#else
@ -183,13 +189,13 @@ void MApplication::LoadTranslation()
#endif
installTranslator(qtxmlTranslator);
QTranslator *appTranslator = new QTranslator(this);
appTranslator = new QTranslator(this);
bool result = appTranslator->load("valentina_" + checkedLocale, translationsPath());
installTranslator(appTranslator);
const QString checkedSystem = TapeSettings()->GetPMSystemCode();
QTranslator *pmsTranslator = new QTranslator(this);
pmsTranslator = new QTranslator(this);
result = pmsTranslator->load("measurements_" + checkedSystem + "_" + checkedLocale, translationsPath());
installTranslator(pmsTranslator);
@ -207,10 +213,12 @@ void MApplication::InitTrVars()
{
if (trVars != nullptr)
{
delete trVars;
trVars = nullptr;
trVars->Retranslate();
}
else
{
trVars = new VTranslateVars(TapeSettings()->GetOsSeparator());
}
trVars = new VTranslateVars(TapeSettings()->GetOsSeparator());
}
//---------------------------------------------------------------------------------------------------------------------
@ -331,6 +339,25 @@ void MApplication::ShowDataBase()
}
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::RetranslateGroups()
{
if (not dataBase.isNull())
{
dataBase->RetranslateGroups();
}
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::RetranslateTables()
{
QList<TMainWindow*> list = MainWindows();
for (int i=0; i < list.size(); ++i)
{
list.at(i)->RetranslateTable();
}
}
//---------------------------------------------------------------------------------------------------------------------
#if defined(Q_WS_MAC)
bool MApplication::event(QEvent* event)
@ -410,3 +437,35 @@ void MApplication::Clean()
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void MApplication::ClearTranslation()
{
if (qtTranslator != nullptr)
{
removeTranslator(qtTranslator);
delete qtTranslator;
qtTranslator = nullptr;
}
if (qtxmlTranslator != nullptr)
{
removeTranslator(qtxmlTranslator);
delete qtxmlTranslator;
qtxmlTranslator = nullptr;
}
if (appTranslator != nullptr)
{
removeTranslator(appTranslator);
delete appTranslator;
appTranslator = nullptr;
}
if (pmsTranslator != nullptr)
{
removeTranslator(pmsTranslator);
delete pmsTranslator;
pmsTranslator = nullptr;
}
}

View File

@ -73,6 +73,8 @@ public:
QString diagramsPath() const;
void ShowDataBase();
void RetranslateGroups();
void RetranslateTables();
public slots:
TMainWindow *NewMainWindow();
@ -87,8 +89,13 @@ private:
QLocalServer *localServer;
VTranslateVars *trVars;
QPointer<DialogMDataBase> dataBase;
QTranslator *qtTranslator;
QTranslator *qtxmlTranslator;
QTranslator *appTranslator;
QTranslator *pmsTranslator;
void Clean();
void ClearTranslation();
};
#endif // MAPPLICATION_H

View File

@ -108,6 +108,14 @@ QString TMainWindow::CurrentFile() const
return curFile;
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::RetranslateTable()
{
const int row = ui->tableWidget->currentRow();
RefreshTable();
ui->tableWidget->selectRow(row);
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::LoadFile(const QString &path)
{
@ -316,6 +324,19 @@ void TMainWindow::closeEvent(QCloseEvent *event)
}
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
}
// remember to call base class implementation
QMainWindow::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::FileSave()
{

View File

@ -56,6 +56,8 @@ public:
QString CurrentFile() const;
void RetranslateTable();
public slots:
void LoadFile(const QString &path);
void FileNew();
@ -65,6 +67,7 @@ public slots:
protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private slots:
void FileSave();

View File

@ -554,3 +554,351 @@ void CheckFactor(qreal &oldFactor, const qreal &Newfactor)
oldFactor = Newfactor;
}
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupA()
{
const QStringList list = QStringList() << height_M // A01
<< heightNeckBack_M // A02
<< heightScapula_M // A03
<< heightArmpit_M // A04
<< heightWaistSide_M // A05
<< heightHip_M // A06
<< heightGlutealFold_M // A07
<< heightKnee_M // A08
<< heightCalf_M // A09
<< heightAnkleHigh_M // A10
<< heightAnkle_M // A11
<< heightHighhip_M // A12
<< heightWaistFront_M // A13
<< heightBustpoint_M // A14
<< heightShoulderTip_M // A15
<< heightNeckFront_M // A16
<< heightNeckSide_M // A17
<< heightNeckBackToKnee_M // A18
<< heightWaistSideToKnee_M // A19
<< heightWaistSideToHip_M; // A20
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupB()
{
const QStringList list = QStringList() << widthShoulder_M // B01
<< widthBust_M // B02
<< widthWaist_M // B03
<< widthHip_M // B04
<< widthAbdomenToHip_M; // B05
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupC()
{
const QStringList list = QStringList() << indentNeckBack_M // C01
<< indentWaistBack_M // C02
<< indentAnkleHigh_M; // C03
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupD()
{
const QStringList list = QStringList() << neckMidCirc_M // D01
<< neckCirc_M // D02
<< highbustCirc_M // D03
<< bustCirc_M // D04
<< lowbustCirc_M // D05
<< ribCirc_M // D06
<< waistCirc_M // D07
<< highhipCirc_M // D08
<< hipCirc_M // D09
<< neckArcF_M // D10
<< highbustArcF_M // D11
<< bustArcF_M // D12
<< lowbustArcF_M // D13
<< ribArcF_M // D14
<< waistArcF_M // D15
<< highhipArcF_M // D16
<< hipArcF_M // D17
<< neckArcB_M // D18
<< highbustArcB_M // D19
<< bustArcB_M // D20
<< lowbustArcB_M // D21
<< ribArcB_M // D22
<< waistArcB_M // D23
<< highhipArcB_M // D24
<< hipArcB_M // D25
<< neckArcHalfF_M // D26
<< highbustArcHalfF_M // D27
<< bustArcHalfF_M // D28
<< lowbustArcHalfF_M // D29
<< ribArcHalfF_M // D30
<< waistArcHalfF_M // D31
<< highhipArcHalfF_M // D32
<< hipArcHalfF_M // D33
<< neckArcHalfB_M // D34
<< highbustArcHalfB_M // D35
<< bustArcHalfB_M // D36
<< lowbustArcHalfB_M // D37
<< ribArcHalfB_M // D38
<< waistArcHalfB_M // D39
<< highhipArcHalfB_M // D40
<< hipArcHalfB_M // D41
<< hipWithAbdomenArcF_M // D42
<< bodyArmfoldCirc_M // D43
<< bodyBustCirc_M // D44
<< bodyTorsoCirc_M; // D45
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupE()
{
const QStringList list = QStringList() << neckFrontToWaistF_M // E01
<< neckFrontToWaistFlatF_M // E02
<< armpitToWaistSide_M // E03
<< shoulderTipToWaistSideF_M // E04
<< neckSideToWaistF_M // E05
<< neckSideToWaistBustpointF_M // E06
<< shoulderTipToWaistSideB_M // E07
<< neckSideToWaistB_M // E08
<< neckBackToWaistB_M // E09
<< neckSideToWaistBladepointB_M // E10
<< shoulderTipToArmfoldF_M // E11
<< neckSideToBustF_M // E12
<< neckSideToHighbustF_M // E13
<< shoulderCenterToHighbustF_M // E14
<< neckFrontToHighbustF_M // E15
<< neckFrontToBustF_M // E16
<< lowbustToWaistF_M // E17
<< shoulderTipToArmfoldB_M // E18
<< neckSideToBustB_M // E19
<< neckSideToHighbustB_M // E20
<< shoulderCenterToHighbustB_M // E21
<< neckBackToHighbustB_M // E22
<< neckBackToBustB_M // E23
<< lowbustToWaistB_M // E24
<< waistToHighhipF_M // E25
<< waistToHipF_M // E26
<< waistToHighhipSide_M // E27
<< waistToHighhipB_M // E28
<< waistToHipB_M // E29
<< waistToHipSide_M // E30
<< shoulderSlopeNeckSideLength_M // E31
<< shoulderSlopeNeckSideAngle_M // E32
<< shoulderSlopeNeckBackHeight_M // E33
<< shoulderSlopeNeckBackAngle_M // E34
<< shoulderSlopeShoulderTipAngle_M // E35
<< highbustToWaistF_M // E36
<< highbustToWaistB_M; // E37
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupF()
{
const QStringList list = QStringList() << shoulderLength_M // F01
<< shoulderWidthF_M // F02
<< acrossChestF_M // F03
<< armfoldToArmfoldF_M // F04
<< shoulderWidthB_M // F05
<< acrossBackB_M // F06
<< armfoldToArmfoldB_M // F07
<< shoulderTipToShoulderTipHalfF_M // F08
<< acrossChestHalfF_M // F09
<< shoulderTipToShoulderTipHalfB_M // F10
<< acrossBackHalfB_M // F11
<< neckFrontToShoulderTipF_M // F12
<< neckBackToShoulderTipB_M // F13
<< neckWidth_M; // F14
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupG()
{
const QStringList list = QStringList() << bustpointToBustpoint_M // G01
<< bustpointToNeckSide_M // G02
<< bustpointToLowbust_M // G03
<< bustpointToWaist_M // G04
<< bustpointToBustpointHalf_M // G05
<< bustpointToBustpointHalter_M // G06
<< bustpointToShoulderTip_M // G07
<< bustpointToWaistFront_M; // G08
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupH()
{
const QStringList list = QStringList() << shoulderTipToWaistFront_M // H01
<< neckFrontToWaistSide_M // H02
<< neckSideToWaistSideF_M // H03
<< neckSideToArmfoldF_M // H04
<< neckSideToArmpitF_M // H05
<< neckSideToBustSideF_M // H06
<< shoulderTipToWaistBack_M // H07
<< neckBackToWaistSide_M // H08
<< neckSideToWaistSideB_M // H09
<< neckSideToArmfoldB_M // H10
<< neckSideToArmpitB_M // H11
<< neckSideToBustSideB_M; // H12
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupI()
{
const QStringList list = QStringList() << armShoulderTipToWristBent_M // I01
<< armShoulderTipToElbowBent_M // I02
<< armElbowToWristBent_M // I03
<< armElbowCircBent_M // I04
<< armShoulderTipToWrist_M // I05
<< armShoulderTipToElbow_M // I06
<< armElbowToWrist_M // I07
<< armArmpitToWrist_M // I08
<< armArmpitToElbow_M // I09
<< armElbowToWristInside_M // I10
<< armUpperCirc_M // I11
<< armAboveElbowCirc_M // I12
<< armElbowCirc_M // I13
<< armLowerCirc_M // I14
<< armWristCirc_M // I15
<< armShoulderTipToArmfoldLine_M // I16
<< armscyeCirc_M // I17
<< armscyeLength_M // I18
<< armscyeWidth_M // I19
<< armNeckSideToFingerTip_M // I20
<< armNeckSideToWrist_M; // I21
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupJ()
{
const QStringList list = QStringList() << legCrotchToFloor_M // J01
<< legWaistSideToFloor_M // J02
<< legWaistSideToKnee_M // J03
<< legThighUpperCirc_M // J04
<< legThighMidCirc_M // J05
<< legKneeCirc_M // J06
<< legKneeSmallCirc_M // J07
<< legCalfCirc_M // J08
<< legAnkleHighCirc_M // J09
<< legAnkleCirc_M // J10
<< legKneeCircBent_M // J11
<< legAnkleDiagCirc_M // J12
<< legCrotchToAnkle_M // J13
<< legWaistSideToAnkle_M; // J14
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupK()
{
const QStringList list = QStringList() << crotchLength_M // K01
<< crotchLengthB_M // K02
<< crotchLengthF_M // K03
<< riseLengthSide_M // K04
<< riseLengthDiag_M // K05
<< riseLengthB_M // K06
<< riseLengthF_M; // K07
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupL()
{
const QStringList list = QStringList() << handPalmLength_M // L01
<< handLength_M // L02
<< handPalmWidth_M // L03
<< handPalmCirc_M // L04
<< handCirc_M; // L05
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupM()
{
const QStringList list = QStringList() << footWidth_M // M01
<< footLength_M // M02
<< footCirc_M // M03
<< footInstepCirc_M; // M04
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupN()
{
const QStringList list = QStringList() << headCirc_M // N01
<< headLength_M // N02
<< headDepth_M // N03
<< headWidth_M // N04
<< headCrownToNeckBack_M // N05
<< headChinToNeckBack_M; // N06
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupO()
{
const QStringList list = QStringList() << neckBackToWaistFront_M // O01
<< waistToWaistHalter_M // O02
<< waistNaturalCirc_M // O03
<< waistNaturalArcF_M // O04
<< waistNaturalArcB_M // O05
<< waistToNaturalWaistF_M // O06
<< waistToNaturalWaistB_M // O07
<< armNeckBackToElbowBent_M // O08
<< armNeckBackToWristBent_M // O09
<< armNeckSideToElbowBent_M // O10
<< armNeckSideToWristBent_M // O11
<< armAcrossBackCenterToElbowBent_M // O12
<< armAcrossBackCenterToWristBent_M // O13
<< armArmscyeBackCenterToWristBent_M; // O14
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupP()
{
const QStringList list = QStringList() << armfoldToArmfoldBust_M // P01
<< armfoldToBustFront_M // P02
<< neckBackToBustFront_M // P03
<< neckBackToArmfoldFront_M // P04
<< neckBackToArmfoldFrontToWaistSide_M // P05
<< highbustBackOverShoulderToArmfoldFront_M // P06
<< highbustBackOverShoulderToWaistFront_M // P07
<< neckBackToArmfoldFrontToNeckBack_M // P08
<< acrossBackCenterToArmfoldFrontToAcrossBackCenter_M // P09
<< neckBackToArmfoldFrontToHighbustBack_M // P10
<< highbustBOverShoulderToHighbustF_M // P11
<< armscyeArc_M; // P12
return list;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList ListGroupQ()
{
const QStringList list = QStringList() << dartWidthShoulder_M // Q01
<< dartWidthBust_M // Q02
<< dartWidthWaist_M; // Q03
return list;
}

View File

@ -454,6 +454,24 @@ extern const QString dartWidthShoulder_M; // Q01
extern const QString dartWidthBust_M; // Q02
extern const QString dartWidthWaist_M; // Q03
QStringList ListGroupA();
QStringList ListGroupB();
QStringList ListGroupC();
QStringList ListGroupD();
QStringList ListGroupE();
QStringList ListGroupF();
QStringList ListGroupG();
QStringList ListGroupH();
QStringList ListGroupI();
QStringList ListGroupJ();
QStringList ListGroupK();
QStringList ListGroupL();
QStringList ListGroupM();
QStringList ListGroupN();
QStringList ListGroupO();
QStringList ListGroupP();
QStringList ListGroupQ();
// pattern making systems codes
extern const QString p0_S;
extern const QString p1_S;

View File

@ -117,6 +117,17 @@ QString VTranslateMeasurements::Description(const QString &measurement) const
return descriptions.value(measurement).translate();
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateMeasurements::Retranslate()
{
measurements.clear();
guiTexts.clear();
descriptions.clear();
numbers.clear();
formulas.clear();
InitMeasurements();
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateMeasurements::InitMeasurements()
{

View File

@ -47,6 +47,8 @@ public:
QString GuiText(const QString &measurement) const;
QString Description(const QString &measurement) const;
virtual void Retranslate();
protected:
QMap<QString, qmu::QmuTranslation> measurements;

View File

@ -923,4 +923,24 @@ QString VTranslateVars::FormulaToUser(const QString &formula) const
return newFormula;
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::Retranslate()
{
VTranslateMeasurements::Retranslate();
PMSystemNames.clear();
PMSystemAuthors.clear();
PMSystemBooks.clear();
variables.clear();
functions.clear();
postfixOperators.clear();
stDescriptions.clear();
InitPatternMakingSystems();
InitVariables();
InitFunctions();
InitPostfixOperators();
InitSTDescriptions();
}

View File

@ -55,6 +55,8 @@ public:
QString FormulaFromUser(const QString &formula, bool osSeparator) const;
QString FormulaToUser(const QString &formula) const;
virtual void Retranslate() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(VTranslateVars)
QMap<QString, qmu::QmuTranslation> PMSystemNames;