diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp new file mode 100644 index 000000000..8d5a5ad82 --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp @@ -0,0 +1,271 @@ +/************************************************************************ + ** + ** @file tapeTapeConfigurationPage.cpp + ** @author Roman Telezhynskyi + ** @date 02 08, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "tapeconfigurationpage.h" +#include "../../mapplication.h" +#include "../vmisc/vtapesettings.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------------------------------------- +TapeConfigurationPage::TapeConfigurationPage(QWidget *parent) + : QWidget(parent), + langCombo(nullptr), + systemCombo(nullptr), + labelCombo(nullptr), + unitCombo(nullptr), + osOptionCheck(nullptr), + langChanged(false), + systemChanged(false), + unitChanged(false), + labelLangChanged(false), + sendReportCheck(nullptr), + askPointDeletionCheck(nullptr), + toolBarStyleCheck(nullptr), + systemAuthorValueLabel(nullptr), + systemBookValueLabel(nullptr) +{ + QGroupBox *langGroup = LangGroup(); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(langGroup); + mainLayout->addStretch(1); + setLayout(mainLayout); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::Apply() +{ + qApp->TapeSettings()->SetOsSeparator(osOptionCheck->isChecked()); + + if (langChanged || systemChanged) + { + const QString locale = qvariant_cast(langCombo->itemData(langCombo->currentIndex())); + qApp->TapeSettings()->SetLocale(locale); + langChanged = false; + + const QString code = qvariant_cast(systemCombo->itemData(systemCombo->currentIndex())); + qApp->TapeSettings()->SetPMSystemCode(code); + systemChanged = false; + + qApp->LoadTranslation(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::LangChanged() +{ + langChanged = true; +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::SystemChanged() +{ + systemChanged = true; + systemAuthorValueLabel->setText(qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString())); + systemBookValueLabel->setText(qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString())); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::UnitChanged() +{ + this->unitChanged = true; +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::LabelLangChanged() +{ + labelLangChanged = true; +} + +//--------------------------------------------------------------------------------------------------------------------- +QGroupBox *TapeConfigurationPage::LangGroup() +{ + QGroupBox *langGroup = new QGroupBox(tr("Language")); + QLabel *guiLabel = new QLabel(tr("GUI language")); + langCombo = new QComboBox; + + QDir dir(qApp->translationsPath()); + const QStringList fileNames = dir.entryList(QStringList("valentina_*.qm")); + + for (int i = 0; i < fileNames.size(); ++i) + { + // get locale extracted by filename + QString locale; + locale = fileNames.at(i); // "valentina_de_De.qm" + locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De" + locale.remove(0, locale.indexOf('_') + 1); // "de_De" + + QLocale loc = QLocale(locale); + QString lang = loc.nativeLanguageName(); + QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country()))); + + langCombo->addItem(ico, lang, locale); + } + + if (langCombo->count() == 0) + { + // English language is internal and doens't have own *.qm file. + QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates))); + QString lang = QLocale("en_US").nativeLanguageName(); + langCombo->addItem(ico, lang, "en_US"); + } + + // set default translators and language checked + qint32 index = langCombo->findData(qApp->TapeSettings()->GetLocale()); + if (index != -1) + { + langCombo->setCurrentIndex(index); + } + connect(langCombo, static_cast(&QComboBox::currentIndexChanged), this, + &TapeConfigurationPage::LangChanged); + + QFormLayout *langLayout = new QFormLayout; + langLayout->addRow(guiLabel, langCombo); + + //-------------------- Pattern making system + QLabel *systemLabel = new QLabel(tr("Pattern making system")); + systemCombo = new QComboBox; + + InitPMSystems(systemCombo); + + langLayout->addRow(systemLabel, systemCombo); + + //---- + QLabel *systemAuthorLabel = new QLabel(tr("Author:")); + systemAuthorValueLabel = new QLabel(qApp->TrVars()->PMSystemAuthor(p0_S)); + + langLayout->addRow(systemAuthorLabel, systemAuthorValueLabel); + + //---- + QLabel *systemBookLabel = new QLabel(tr("Book:")); + systemBookValueLabel = new QLabel(qApp->TrVars()->PMSystemBook(p0_S)); + systemBookValueLabel->setWordWrap(true); + + langLayout->addRow(systemBookLabel, systemBookValueLabel); + + // set default pattern making system + index = systemCombo->findData(qApp->TapeSettings()->GetPMSystemCode()); + if (index != -1) + { + systemCombo->setCurrentIndex(index); + } + connect(systemCombo, static_cast(&QComboBox::currentIndexChanged), this, + &TapeConfigurationPage::SystemChanged); + + //-------------------- Decimal separator setup + QLabel *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()); + + langLayout->addRow(separatorLabel, osOptionCheck); + //----------------------- + langGroup->setLayout(langLayout); + + return langGroup; +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::SetLabelComboBox(const QStringList &list) +{ + for (int i = 0; i < list.size(); ++i) + { + QLocale loc = QLocale(list.at(i)); + labelCombo->addItem(loc.nativeLanguageName(), list.at(i)); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigurationPage::InitPMSystems(QComboBox *systemCombo) +{ + systemCombo->addItem(qApp->TrVars()->PMSystemName(p0_S), p0_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p1_S), p1_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p2_S), p2_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p3_S), p3_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p4_S), p4_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p5_S), p5_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p6_S), p6_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p7_S), p7_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p8_S), p8_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p9_S), p9_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p10_S), p10_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p11_S), p11_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p12_S), p12_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p13_S), p13_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p14_S), p14_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p15_S), p15_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p16_S), p16_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p17_S), p17_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p18_S), p18_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p19_S), p19_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p20_S), p20_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p21_S), p21_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p22_S), p22_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p23_S), p23_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p24_S), p24_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p25_S), p25_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p26_S), p26_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p27_S), p27_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p28_S), p28_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p29_S), p29_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p30_S), p30_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p31_S), p31_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p32_S), p32_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p33_S), p33_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p34_S), p34_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p35_S), p35_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p36_S), p36_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p37_S), p37_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p38_S), p38_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p39_S), p39_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p40_S), p40_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p41_S), p41_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p42_S), p42_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p43_S), p43_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p44_S), p44_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p45_S), p45_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p46_S), p46_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p47_S), p47_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p48_S), p48_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p49_S), p49_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p50_S), p50_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p51_S), p51_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p52_S), p52_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p53_S), p53_S); + systemCombo->addItem(qApp->TrVars()->PMSystemName(p54_S), p54_S); +} diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.h b/src/app/tape/dialogs/configpages/tapeconfigurationpage.h new file mode 100644 index 000000000..112f7e29a --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.h @@ -0,0 +1,74 @@ +/************************************************************************ + ** + ** @file tapeconfigurationpage.h + ** @author Roman Telezhynskyi + ** @date 02 08, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef CONFIGURATIONPAGE_H +#define CONFIGURATIONPAGE_H + +#include +#include + +class QCheckBox; +class QSpinBox; +class QComboBox; +class QGroupBox; +class QLabel; + +class TapeConfigurationPage : public QWidget +{ + Q_OBJECT +public: + TapeConfigurationPage(QWidget *parent = nullptr); + void Apply(); +public slots: + void LangChanged(); + void SystemChanged(); + void UnitChanged(); + void LabelLangChanged(); +private: + Q_DISABLE_COPY(TapeConfigurationPage) + QComboBox *langCombo; + QComboBox *systemCombo; + QComboBox *labelCombo; + QComboBox *unitCombo; + QCheckBox *osOptionCheck; + bool langChanged; + bool systemChanged; + bool unitChanged; + bool labelLangChanged; + QCheckBox *sendReportCheck; + QCheckBox *askPointDeletionCheck; + QCheckBox *toolBarStyleCheck; + QLabel *systemAuthorValueLabel; + QLabel *systemBookValueLabel; + + QGroupBox *LangGroup(); + void SetLabelComboBox(const QStringList &list); + void InitPMSystems(QComboBox *systemCombo); +}; + +#endif // CONFIGURATIONPAGE_H diff --git a/src/app/tape/dialogs/configpages/tapepathpage.cpp b/src/app/tape/dialogs/configpages/tapepathpage.cpp new file mode 100644 index 000000000..161e6edcc --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapepathpage.cpp @@ -0,0 +1,207 @@ +/************************************************************************ + ** + ** @file tapepathpage.cpp + ** @author Roman Telezhynskyi + ** @date 02 08, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "tapepathpage.h" +#include "../../mapplication.h" +#include "../vmisc/vtapesettings.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------------------------------------------------------- +TapePathPage::TapePathPage(QWidget *parent) + : QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr) +{ + QGroupBox *pathGroup = PathGroup(); + SCASSERT(pathGroup != nullptr); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(pathGroup); + mainLayout->addStretch(1); + setLayout(mainLayout); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePathPage::Apply() +{ + qApp->TapeSettings()->SetPathIndividualMeasurements(pathTable->item(0, 1)->text()); + qApp->TapeSettings()->SetPathStandardMeasurements(pathTable->item(1, 1)->text()); + qApp->TapeSettings()->SetPathTemplate(pathTable->item(2, 1)->text()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePathPage::TableActivated() +{ + defaultButton->setEnabled(true); + defaultButton->setDefault(false); + + editButton->setEnabled(true); + editButton->setDefault(true); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePathPage::DefaultPath() +{ + const int row = pathTable->currentRow(); + QTableWidgetItem *item = pathTable->item(row, 1); + SCASSERT(item != nullptr); + + switch (row) + { + case 0: // individual measurements + item->setText(QDir::homePath()); + item->setToolTip(QDir::homePath()); + break; + case 1: // standard measurements + item->setText(qApp->TapeSettings()->StandardTablesPath()); + item->setToolTip(qApp->TapeSettings()->StandardTablesPath()); + break; + case 2: // templates + item->setText(qApp->TapeSettings()->TemplatesPath()); + item->setToolTip(qApp->TapeSettings()->TemplatesPath()); + break; + default: + break; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePathPage::EditPath() +{ + const int row = pathTable->currentRow(); + QTableWidgetItem *item = pathTable->item(row, 1); + SCASSERT(item != nullptr); + + QString path; + switch (row) + { + case 0: // individual measurements + path = qApp->TapeSettings()->GetPathIndividualMeasurements(); + break; + case 1: // standard measurements + path = qApp->TapeSettings()->GetPathStandardMeasurements(); + break; + case 2: // templates + path = qApp->TapeSettings()->GetPathTemplate(); + break; + default: + break; + } + QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), path, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + if (dir.isEmpty()) + { + DefaultPath(); + return; + } + + item->setText(dir); + item->setToolTip(dir); +} + +//--------------------------------------------------------------------------------------------------------------------- +QGroupBox *TapePathPage::PathGroup() +{ + QGroupBox *pathGroup = new QGroupBox(tr("Path that use Valentina")); + InitTable(); + + defaultButton = new QPushButton(tr("Default")); + defaultButton->setEnabled(false); + connect(defaultButton, &QPushButton::clicked, this, &TapePathPage::DefaultPath); + + editButton = new QPushButton(tr("Edit")); + editButton->setEnabled(false); + connect(editButton, &QPushButton::clicked, this, &TapePathPage::EditPath); + + QHBoxLayout *buttonsLayout = new QHBoxLayout; + buttonsLayout->addWidget(defaultButton); + buttonsLayout->addWidget(editButton); + + QVBoxLayout *pathLayout = new QVBoxLayout; + pathLayout->addWidget(pathTable); + pathLayout->addLayout(buttonsLayout); + + pathGroup->setLayout(pathLayout); + return pathGroup; +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapePathPage::InitTable() +{ + pathTable = new QTableWidget(); + pathTable->setRowCount(4); + pathTable->setColumnCount(2); + pathTable->verticalHeader()->setVisible(false); + pathTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + pathTable->setSelectionBehavior(QAbstractItemView::SelectRows); + pathTable->setSelectionMode(QAbstractItemView::SingleSelection); + pathTable->setShowGrid(false); + + QStringList tableHeader = QStringList() << tr("Type") << tr("Path"); + pathTable->setHorizontalHeaderLabels(tableHeader); + + { + pathTable->setItem(0, 0, new QTableWidgetItem(tr("Individual measurements"))); + QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathIndividualMeasurements()); + item->setToolTip(qApp->TapeSettings()->GetPathIndividualMeasurements()); + pathTable->setItem(0, 1, item); + } + + { + pathTable->setItem(1, 0, new QTableWidgetItem(tr("Standard measurements"))); + QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathStandardMeasurements()); + item->setToolTip(qApp->TapeSettings()->GetPathStandardMeasurements()); + pathTable->setItem(1, 1, item); + } + + { + pathTable->setItem(2, 0, new QTableWidgetItem(tr("Templates"))); + QTableWidgetItem *item = new QTableWidgetItem(qApp->TapeSettings()->GetPathTemplate()); + item->setToolTip(qApp->TapeSettings()->GetPathTemplate()); + pathTable->setItem(2, 1, item); + } + + pathTable->verticalHeader()->setDefaultSectionSize(20); + pathTable->resizeColumnsToContents(); + pathTable->resizeRowsToContents(); + pathTable->horizontalHeader()->setStretchLastSection(true); + + connect(pathTable, &QTableWidget::itemSelectionChanged, this, &TapePathPage::TableActivated); +} diff --git a/src/app/tape/dialogs/configpages/tapepathpage.h b/src/app/tape/dialogs/configpages/tapepathpage.h new file mode 100644 index 000000000..53048bac6 --- /dev/null +++ b/src/app/tape/dialogs/configpages/tapepathpage.h @@ -0,0 +1,58 @@ +/************************************************************************ + ** + ** @file tapepathpage.h + ** @author Roman Telezhynskyi + ** @date 02 08, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef PATHPAGE_H +#define PATHPAGE_H + +#include +#include + +class QGroupBox; +class QPushButton; +class QTableWidget; + +class TapePathPage : public QWidget +{ + Q_OBJECT +public: + TapePathPage(QWidget *parent = nullptr); + void Apply(); +public slots: + void TableActivated(); + void DefaultPath(); + void EditPath(); +private: + Q_DISABLE_COPY(TapePathPage) + QPushButton *defaultButton; + QPushButton *editButton; + QTableWidget *pathTable; + QGroupBox *PathGroup(); + void InitTable(); +}; + +#endif // PATHPAGE_H diff --git a/src/app/tape/dialogs/tapeconfigdialog.cpp b/src/app/tape/dialogs/tapeconfigdialog.cpp new file mode 100644 index 000000000..4a43009cf --- /dev/null +++ b/src/app/tape/dialogs/tapeconfigdialog.cpp @@ -0,0 +1,158 @@ +/************************************************************************ + ** + ** @file tapeconfigdialog.cpp + ** @author Roman Telezhynskyi + ** @date 02 08, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#include "tapeconfigdialog.h" +#include +#include +#include +#include +#include +#include +#include "../mapplication.h" + +//--------------------------------------------------------------------------------------------------------------------- +TapeConfigDialog::TapeConfigDialog(QWidget *parent) + :QDialog(parent), + contentsWidget(nullptr), + pagesWidget(nullptr), + configurationPage(nullptr), + pathPage(nullptr) +{ + contentsWidget = new QListWidget; + contentsWidget->setViewMode(QListView::IconMode); + contentsWidget->setIconSize(QSize(96, 84)); + contentsWidget->setMovement(QListView::Static); + contentsWidget->setMaximumWidth(128); + contentsWidget->setMinimumHeight(250); + contentsWidget->setSpacing(12); + + pagesWidget = new QStackedWidget; + + configurationPage = new TapeConfigurationPage(); + pagesWidget->addWidget(configurationPage); + + pathPage = new TapePathPage(); + pagesWidget->addWidget(pathPage); + + QPushButton *applyButton = new QPushButton(tr("Apply")); + QPushButton *canselButton = new QPushButton(tr("&Cancel")); + QPushButton *okButton = new QPushButton(tr("&Ok")); + + createIcons(); + contentsWidget->setCurrentRow(0); + + connect(canselButton, &QPushButton::clicked, this, &TapeConfigDialog::close); + connect(applyButton, &QPushButton::clicked, this, &TapeConfigDialog::Apply); + connect(okButton, &QPushButton::clicked, this, &TapeConfigDialog::Ok); + + QHBoxLayout *horizontalLayout = new QHBoxLayout; + horizontalLayout->addWidget(contentsWidget); + horizontalLayout->addWidget(pagesWidget, 1); + + QHBoxLayout *buttonsLayout = new QHBoxLayout; + buttonsLayout->addStretch(1); + buttonsLayout->addWidget(applyButton); + buttonsLayout->addWidget(canselButton); + buttonsLayout->addWidget(okButton); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addLayout(horizontalLayout); + mainLayout->addStretch(1); + mainLayout->addSpacing(12); + mainLayout->addLayout(buttonsLayout); + setLayout(mainLayout); + + setWindowTitle(tr("Config Dialog")); + + qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) +{ + if (current == nullptr) + { + current = previous; + } + pagesWidget->setCurrentIndex(contentsWidget->row(current)); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::closeEvent(QCloseEvent *event) +{ + if (result() == QDialog::Accepted) + { + done(QDialog::Accepted); + } + event->accept(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::createIcons() +{ + createIcon("://icon/config.png", tr("Configuration")); + createIcon("://icon/path_config.png", tr("Paths")); + + connect(contentsWidget, &QListWidget::currentItemChanged, this, &TapeConfigDialog::changePage); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::createIcon(const QString &icon, const QString &text) +{ + QListWidgetItem *button = new QListWidgetItem(contentsWidget); + button->setIcon(QIcon(icon)); + button->setText(text); + button->setTextAlignment(Qt::AlignHCenter); + button->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::Apply() +{ + switch (contentsWidget->currentRow()) + { + case (0): + configurationPage->Apply(); + break; + case (1): + pathPage->Apply(); + break; + default: + break; + } + qApp->TapeSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); + emit UpdateProperties(); + setResult(QDialog::Accepted); +} + +//--------------------------------------------------------------------------------------------------------------------- +void TapeConfigDialog::Ok() +{ + Apply(); + done(QDialog::Accepted); +} diff --git a/src/app/tape/dialogs/tapeconfigdialog.h b/src/app/tape/dialogs/tapeconfigdialog.h new file mode 100644 index 000000000..582fb1baf --- /dev/null +++ b/src/app/tape/dialogs/tapeconfigdialog.h @@ -0,0 +1,64 @@ +/************************************************************************ + ** + ** @file tapeconfigdialog.h + ** @author Roman Telezhynskyi + ** @date 02 08, 2015 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013-2015 Valentina project + ** All Rights Reserved. + ** + ** Valentina is free software: you can redistribute it and/or modify + ** it under the terms of the GNU General Public License as published by + ** the Free Software Foundation, either version 3 of the License, or + ** (at your option) any later version. + ** + ** Valentina is distributed in the hope that it will be useful, + ** but WITHOUT ANY WARRANTY; without even the implied warranty of + ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ** GNU General Public License for more details. + ** + ** You should have received a copy of the GNU General Public License + ** along with Valentina. If not, see . + ** + *************************************************************************/ + +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include +#include "configpages/tapeconfigurationpage.h" +#include "configpages/tapepathpage.h" + +class QListWidgetItem; +class QStackedWidget; +class QListWidget; + +class TapeConfigDialog : public QDialog +{ + Q_OBJECT +public: + explicit TapeConfigDialog(QWidget *parent = nullptr); +public slots: + void changePage(QListWidgetItem *current, QListWidgetItem *previous); +signals: + void UpdateProperties(); +protected: + virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; +private: + Q_DISABLE_COPY(TapeConfigDialog) + QListWidget *contentsWidget; + QStackedWidget *pagesWidget; + TapeConfigurationPage *configurationPage; + TapePathPage *pathPage; + + void createIcons(); + void createIcon(const QString &icon, const QString &text); + void Apply(); + void Ok(); +}; + +#endif // CONFIGDIALOG_H diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp index e3c8e6131..fa361ea0f 100644 --- a/src/app/tape/main.cpp +++ b/src/app/tape/main.cpp @@ -41,6 +41,7 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(theme); Q_INIT_RESOURCE(icon); Q_INIT_RESOURCE(schema); + Q_INIT_RESOURCE(flags); QT_REQUIRE_VERSION(argc, argv, "5.0.0"); diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 438662286..2c39b5d9d 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -97,6 +97,12 @@ MApplication::~MApplication() TMainWindow *window = mainWindows.at(i); delete window; } + + delete trVars; + if (not dataBase.isNull()) + { + delete dataBase; + } } //--------------------------------------------------------------------------------------------------------------------- @@ -140,6 +146,24 @@ void MApplication::InitOptions() qDebug()<<"Command-line arguments:"<arguments(); qDebug()<<"Process ID:"<applicationPid(); + LoadTranslation(); + + static const char * GENERIC_ICON_TO_CHECK = "document-open"; + if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false) + { + //If there is no default working icon theme then we should + //use an icon theme that we provide via a .qrc file + //This case happens under Windows and Mac OS X + //This does not happen under GNOME or KDE + QIcon::setThemeName("win.icon.theme"); + } + + QResource::registerResource(diagramsPath()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void MApplication::LoadTranslation() +{ const QString checkedLocale = TapeSettings()->GetLocale(); qDebug()<<"Checked locale:"<load("valentina_" + checkedLocale, translationsPath()); installTranslator(appTranslator); + const QString checkedSystem = TapeSettings()->GetPMSystemCode(); + + QTranslator *pmsTranslator = new QTranslator(this); + pmsTranslator->load("measurements_" + checkedSystem + "_" + checkedLocale, translationsPath()); + installTranslator(pmsTranslator); + InitTrVars();//Very important do it after load QM files. - - static const char * GENERIC_ICON_TO_CHECK = "document-open"; - if (QIcon::hasThemeIcon(GENERIC_ICON_TO_CHECK) == false) - { - //If there is no default working icon theme then we should - //use an icon theme that we provide via a .qrc file - //This case happens under Windows and Mac OS X - //This does not happen under GNOME or KDE - QIcon::setThemeName("win.icon.theme"); - } - - QResource::registerResource(diagramsPath()); } //--------------------------------------------------------------------------------------------------------------------- @@ -187,6 +205,11 @@ const VTranslateVars *MApplication::TrVars() //--------------------------------------------------------------------------------------------------------------------- void MApplication::InitTrVars() { + if (trVars != nullptr) + { + delete trVars; + trVars = nullptr; + } trVars = new VTranslateVars(TapeSettings()->GetOsSeparator()); } @@ -216,7 +239,7 @@ QString MApplication::translationsPath() const } else { - return QApplication::applicationDirPath() + "../../valentina/bin" + trPath; + return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath; } #else #ifdef QT_DEBUG @@ -227,7 +250,7 @@ QString MApplication::translationsPath() const } else { - return QApplication::applicationDirPath() + "../../valentina/bin" + trPath; + return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath; } #else QDir dir1(QApplication::applicationDirPath() + trPath); @@ -236,7 +259,7 @@ QString MApplication::translationsPath() const return dir1.absolutePath(); } - QDir dir2(QApplication::applicationDirPath() + "../../valentina/bin" + trPath); + QDir dir2(QApplication::applicationDirPath() + "/../../valentina/bin" + trPath); if (dir2.exists()) { return dir2.absolutePath(); diff --git a/src/app/tape/mapplication.h b/src/app/tape/mapplication.h index 71700b8de..cab51798e 100644 --- a/src/app/tape/mapplication.h +++ b/src/app/tape/mapplication.h @@ -61,6 +61,7 @@ public: #endif void InitOptions(); + void LoadTranslation(); virtual const VTranslateVars *TrVars(); void InitTrVars(); diff --git a/src/app/tape/tape.pri b/src/app/tape/tape.pri index 1ecd6d63d..0150eea12 100644 --- a/src/app/tape/tape.pri +++ b/src/app/tape/tape.pri @@ -8,7 +8,10 @@ SOURCES += \ $$PWD/mapplication.cpp \ $$PWD/dialogs/dialogabouttape.cpp \ $$PWD/dialogs/dialognewmeasurements.cpp \ - $$PWD/dialogs/dialogmdatabase.cpp + $$PWD/dialogs/dialogmdatabase.cpp \ + $$PWD/dialogs/tapeconfigdialog.cpp \ + $$PWD/dialogs/configpages/tapeconfigurationpage.cpp \ + $$PWD/dialogs/configpages/tapepathpage.cpp HEADERS += \ $$PWD/tmainwindow.h \ @@ -17,7 +20,10 @@ HEADERS += \ $$PWD/dialogs/dialogabouttape.h \ $$PWD/dialogs/dialognewmeasurements.h \ $$PWD/dialogs/dialogmdatabase.h \ - $$PWD/version.h + $$PWD/version.h \ + $$PWD/dialogs/tapeconfigdialog.h \ + $$PWD/dialogs/configpages/tapeconfigurationpage.h \ + $$PWD/dialogs/configpages/tapepathpage.h FORMS += \ $$PWD/tmainwindow.ui \ diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index c2b921e5f..cd10d8abe 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -31,6 +31,7 @@ #include "dialogs/dialogabouttape.h" #include "dialogs/dialognewmeasurements.h" #include "dialogs/dialogmdatabase.h" +#include "dialogs/tapeconfigdialog.h" #include "../vpatterndb/calculator.h" #include "../ifc/ifcdef.h" #include "../ifc/xml/vvitconverter.h" @@ -1150,6 +1151,13 @@ void TMainWindow::NewWindow() qApp->MainWindow()->activateWindow(); } +//--------------------------------------------------------------------------------------------------------------------- +void TMainWindow::Preferences() +{ + TapeConfigDialog dlg(this); + dlg.exec(); +} + //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::SetupMenu() { @@ -1168,6 +1176,7 @@ void TMainWindow::SetupMenu() ui->actionSaveAs->setShortcuts(QKeySequence::SaveAs); connect(ui->actionReadOnly, &QAction::triggered, this, &TMainWindow::ReadOnly); + connect(ui->actionPreferences, &QAction::triggered, this, &TMainWindow::Preferences); connect(ui->actionQuit, &QAction::triggered, this, &TMainWindow::close); ui->actionQuit->setShortcuts(QKeySequence::Quit); diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index 453ad2ba1..1cdc226ac 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -107,6 +107,8 @@ private slots: void NewWindow(); + void Preferences(); + private: Q_DISABLE_COPY(TMainWindow) Ui::TMainWindow *ui; diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui index d22121cc8..11fd59094 100644 --- a/src/app/tape/tmainwindow.ui +++ b/src/app/tape/tmainwindow.ui @@ -595,6 +595,8 @@ + + @@ -793,6 +795,11 @@ Show information about all known measurement + + + Preferences + + diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro index ebf18411d..677fe6287 100644 --- a/src/app/valentina/valentina.pro +++ b/src/app/valentina/valentina.pro @@ -51,7 +51,6 @@ include(valentina.pri) RESOURCES += \ share/resources/cursor.qrc \ # Tools cursor icons. share/resources/measurements.qrc \ # For measurements files that we save as resource. - share/resources/flags.qrc \ share/resources/toolicon.qrc # Compilation will fail without this files after we added them to this section. diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 951050f11..eae3d43ba 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -286,6 +286,63 @@ const QString dartWidthShoulder_M = QStringLiteral("dart_width_shoulder"); // Q0 const QString dartWidthBust_M = QStringLiteral("dart_width_bust"); // Q02 const QString dartWidthWaist_M = QStringLiteral("dart_width_waist"); // Q03 +// pattern making systems codes +const QString p0_S = QStringLiteral("p0"); +const QString p1_S = QStringLiteral("p1"); +const QString p2_S = QStringLiteral("p2"); +const QString p3_S = QStringLiteral("p3"); +const QString p4_S = QStringLiteral("p4"); +const QString p5_S = QStringLiteral("p5"); +const QString p6_S = QStringLiteral("p6"); +const QString p7_S = QStringLiteral("p7"); +const QString p8_S = QStringLiteral("p8"); +const QString p9_S = QStringLiteral("p9"); +const QString p10_S = QStringLiteral("p10"); +const QString p11_S = QStringLiteral("p11"); +const QString p12_S = QStringLiteral("p12"); +const QString p13_S = QStringLiteral("p13"); +const QString p14_S = QStringLiteral("p14"); +const QString p15_S = QStringLiteral("p15"); +const QString p16_S = QStringLiteral("p16"); +const QString p17_S = QStringLiteral("p17"); +const QString p18_S = QStringLiteral("p18"); +const QString p19_S = QStringLiteral("p19"); +const QString p20_S = QStringLiteral("p20"); +const QString p21_S = QStringLiteral("p21"); +const QString p22_S = QStringLiteral("p22"); +const QString p23_S = QStringLiteral("p23"); +const QString p24_S = QStringLiteral("p24"); +const QString p25_S = QStringLiteral("p25"); +const QString p26_S = QStringLiteral("p26"); +const QString p27_S = QStringLiteral("p27"); +const QString p28_S = QStringLiteral("p28"); +const QString p29_S = QStringLiteral("p29"); +const QString p30_S = QStringLiteral("p30"); +const QString p31_S = QStringLiteral("p31"); +const QString p32_S = QStringLiteral("p32"); +const QString p33_S = QStringLiteral("p33"); +const QString p34_S = QStringLiteral("p34"); +const QString p35_S = QStringLiteral("p35"); +const QString p36_S = QStringLiteral("p36"); +const QString p37_S = QStringLiteral("p37"); +const QString p38_S = QStringLiteral("p38"); +const QString p39_S = QStringLiteral("p39"); +const QString p40_S = QStringLiteral("p40"); +const QString p41_S = QStringLiteral("p41"); +const QString p42_S = QStringLiteral("p42"); +const QString p43_S = QStringLiteral("p43"); +const QString p44_S = QStringLiteral("p44"); +const QString p45_S = QStringLiteral("p45"); +const QString p46_S = QStringLiteral("p46"); +const QString p47_S = QStringLiteral("p47"); +const QString p48_S = QStringLiteral("p48"); +const QString p49_S = QStringLiteral("p49"); +const QString p50_S = QStringLiteral("p50"); +const QString p51_S = QStringLiteral("p51"); +const QString p52_S = QStringLiteral("p52"); +const QString p53_S = QStringLiteral("p53"); +const QString p54_S = QStringLiteral("p54"); + //variables const QString line_ = QStringLiteral("Line_"); const QString angleLine_ = QStringLiteral("AngleLine_"); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 686dbc4b4..1b636d630 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -454,6 +454,66 @@ extern const QString dartWidthShoulder_M; // Q01 extern const QString dartWidthBust_M; // Q02 extern const QString dartWidthWaist_M; // Q03 +// pattern making systems codes +extern const QString p0_S; +extern const QString p1_S; +extern const QString p2_S; +extern const QString p3_S; +extern const QString p4_S; +extern const QString p5_S; +extern const QString p6_S; +extern const QString p7_S; +extern const QString p8_S; +extern const QString p9_S; +extern const QString p10_S; +extern const QString p11_S; +extern const QString p12_S; +extern const QString p13_S; +extern const QString p14_S; +extern const QString p15_S; +extern const QString p16_S; +extern const QString p17_S; +extern const QString p18_S; +extern const QString p19_S; +extern const QString p20_S; +extern const QString p21_S; +extern const QString p22_S; +extern const QString p23_S; +extern const QString p24_S; +extern const QString p25_S; +extern const QString p26_S; +extern const QString p27_S; +extern const QString p28_S; +extern const QString p29_S; +extern const QString p30_S; +extern const QString p31_S; +extern const QString p32_S; +extern const QString p33_S; +extern const QString p34_S; +extern const QString p35_S; +extern const QString p36_S; +extern const QString p37_S; +extern const QString p38_S; +extern const QString p39_S; +extern const QString p40_S; +extern const QString p41_S; +extern const QString p42_S; +extern const QString p43_S; +extern const QString p44_S; +extern const QString p45_S; +extern const QString p46_S; +extern const QString p47_S; +extern const QString p48_S; +extern const QString p49_S; +extern const QString p50_S; +extern const QString p51_S; +extern const QString p52_S; +extern const QString p53_S; +extern const QString p54_S; + +extern const QString line_; +extern const QString angleLine_; + // variables name extern const QString line_; extern const QString angleLine_; diff --git a/src/app/valentina/share/resources/flags.qrc b/src/libs/vmisc/share/resources/flags.qrc similarity index 100% rename from src/app/valentina/share/resources/flags.qrc rename to src/libs/vmisc/share/resources/flags.qrc diff --git a/src/app/valentina/share/resources/flags/CzechRepublic.png b/src/libs/vmisc/share/resources/flags/CzechRepublic.png similarity index 100% rename from src/app/valentina/share/resources/flags/CzechRepublic.png rename to src/libs/vmisc/share/resources/flags/CzechRepublic.png diff --git a/src/app/valentina/share/resources/flags/Finland.png b/src/libs/vmisc/share/resources/flags/Finland.png similarity index 100% rename from src/app/valentina/share/resources/flags/Finland.png rename to src/libs/vmisc/share/resources/flags/Finland.png diff --git a/src/app/valentina/share/resources/flags/France.png b/src/libs/vmisc/share/resources/flags/France.png similarity index 100% rename from src/app/valentina/share/resources/flags/France.png rename to src/libs/vmisc/share/resources/flags/France.png diff --git a/src/app/valentina/share/resources/flags/Germany.png b/src/libs/vmisc/share/resources/flags/Germany.png similarity index 100% rename from src/app/valentina/share/resources/flags/Germany.png rename to src/libs/vmisc/share/resources/flags/Germany.png diff --git a/src/app/valentina/share/resources/flags/Indonesia.png b/src/libs/vmisc/share/resources/flags/Indonesia.png similarity index 100% rename from src/app/valentina/share/resources/flags/Indonesia.png rename to src/libs/vmisc/share/resources/flags/Indonesia.png diff --git a/src/app/valentina/share/resources/flags/Israel.png b/src/libs/vmisc/share/resources/flags/Israel.png similarity index 100% rename from src/app/valentina/share/resources/flags/Israel.png rename to src/libs/vmisc/share/resources/flags/Israel.png diff --git a/src/app/valentina/share/resources/flags/Italy.png b/src/libs/vmisc/share/resources/flags/Italy.png similarity index 100% rename from src/app/valentina/share/resources/flags/Italy.png rename to src/libs/vmisc/share/resources/flags/Italy.png diff --git a/src/app/valentina/share/resources/flags/Netherlands.png b/src/libs/vmisc/share/resources/flags/Netherlands.png similarity index 100% rename from src/app/valentina/share/resources/flags/Netherlands.png rename to src/libs/vmisc/share/resources/flags/Netherlands.png diff --git a/src/app/valentina/share/resources/flags/Russia.png b/src/libs/vmisc/share/resources/flags/Russia.png similarity index 100% rename from src/app/valentina/share/resources/flags/Russia.png rename to src/libs/vmisc/share/resources/flags/Russia.png diff --git a/src/app/valentina/share/resources/flags/Spain.png b/src/libs/vmisc/share/resources/flags/Spain.png similarity index 100% rename from src/app/valentina/share/resources/flags/Spain.png rename to src/libs/vmisc/share/resources/flags/Spain.png diff --git a/src/app/valentina/share/resources/flags/Ukraine.png b/src/libs/vmisc/share/resources/flags/Ukraine.png similarity index 100% rename from src/app/valentina/share/resources/flags/Ukraine.png rename to src/libs/vmisc/share/resources/flags/Ukraine.png diff --git a/src/app/valentina/share/resources/flags/UnitedStates.png b/src/libs/vmisc/share/resources/flags/UnitedStates.png similarity index 100% rename from src/app/valentina/share/resources/flags/UnitedStates.png rename to src/libs/vmisc/share/resources/flags/UnitedStates.png diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 890f98f69..702ad2249 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -49,6 +49,7 @@ const QString VCommonSettings::SettingConfigurationAutosaveState = QString const QString VCommonSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time"); const QString VCommonSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state"); const QString VCommonSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale"); +const QString VCommonSettings::SettingPMSystemCode = QStringLiteral("configuration/pmscode"); const QString VCommonSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit"); const QString VCommonSettings::SettingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion"); @@ -161,6 +162,18 @@ void VCommonSettings::SetLocale(const QString &value) setValue(SettingConfigurationLocale, value); } +//--------------------------------------------------------------------------------------------------------------------- +QString VCommonSettings::GetPMSystemCode() const +{ + return value(SettingPMSystemCode, p0_S).toString(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetPMSystemCode(const QString &value) +{ + setValue(SettingPMSystemCode, value); +} + //--------------------------------------------------------------------------------------------------------------------- QString VCommonSettings::GetUnit() const { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 630e21b21..8c4b39f10 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -62,6 +62,9 @@ public: QString GetLocale() const; void SetLocale(const QString &value); + QString GetPMSystemCode() const; + void SetPMSystemCode(const QString &value); + QString GetUnit() const; void SetUnit(const QString &value); @@ -102,6 +105,7 @@ private: static const QString SettingConfigurationAutosaveTime; static const QString SettingConfigurationSendReportState; static const QString SettingConfigurationLocale; + static const QString SettingPMSystemCode; static const QString SettingConfigurationUnit; static const QString SettingConfigurationConfirmItemDeletion; static const QString SettingConfigurationToolBarStyle; diff --git a/src/libs/vmisc/vmisc.pro b/src/libs/vmisc/vmisc.pro index 0c379ae64..190d27086 100644 --- a/src/libs/vmisc/vmisc.pro +++ b/src/libs/vmisc/vmisc.pro @@ -31,7 +31,8 @@ include(vmisc.pri) # Resource files. This files will be included in binary. RESOURCES += \ share/resources/theme.qrc \ # Windows theme icons. - share/resources/icon.qrc # All other icons except cursors and Windows theme. + share/resources/icon.qrc \ # All other icons except cursors and Windows theme. + share/resources/flags.qrc # This is static library so no need in "make install" diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp index c05a25a03..702e04b40 100644 --- a/src/libs/vpatterndb/vtranslatevars.cpp +++ b/src/libs/vpatterndb/vtranslatevars.cpp @@ -35,13 +35,22 @@ using namespace qmu; //--------------------------------------------------------------------------------------------------------------------- VTranslateVars::VTranslateVars(bool osSeparator) - :measurements(QMap()), guiTexts(QMap()), - descriptions(QMap()), variables(QMap()), - functions(QMap()), postfixOperators(QMap()), - stDescriptions(QMap()), numbers(QMap()), - formulas(QMap()), osSeparator(osSeparator) + :measurements(QMap()), + PMSystemNames(QMap()), + PMSystemAuthors(QMap()), + PMSystemBooks(QMap()), + guiTexts(QMap()), + descriptions(QMap()), + variables(QMap()), + functions(QMap()), + postfixOperators(QMap()), + stDescriptions(QMap()), + numbers(QMap()), + formulas(QMap()), + osSeparator(osSeparator) { InitMeasurements(); + InitPatternMakingSystems(); InitVariables(); InitFunctions(); InitPostfixOperators(); @@ -74,6 +83,321 @@ void VTranslateVars::InitMeasurements() InitGroupQ(); // Patternmaking measurements } +//--------------------------------------------------------------------------------------------------------------------- +void VTranslateVars::InitPatternMakingSystems() +{ + //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't + //mark such string to translation. + QmuTranslation name; + QmuTranslation author; + QmuTranslation book; + + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Bunka", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Bunka Fashion College", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Fundamentals of Garment Design", "Book name"); + InitSystem(p0_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Barnfield and Richard", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Jo Barnfield and Andrew Richards", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern Making Primer", "Book name"); + InitSystem(p1_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Friendship/Women", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Elizabeth Friendship", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Creating Historical Clothes - Pattern Cutting from " + "the 16th to the 19th Centuries", "Book name"); + InitSystem(p2_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Morris, K.", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Karen Morris", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Sewing Lingerie that Fits", "Book name"); + InitSystem(p3_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Castro", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Lucia Mors de Castro", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Patternmaking in Practic", "Book name"); + InitSystem(p4_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Kim & Uh", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Injoo Kim and Mykyung Uh", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Apparel Making in Fashion Design", "Book name"); + InitSystem(p5_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Waugh", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Norah Waugh", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Corsets and Crinolines", "Book name"); + InitSystem(p6_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Grimble", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Frances Grimble", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Fashions of the Gilded Age", "Book name"); + InitSystem(p7_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Thornton's International System", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "ed. R. L. Shep", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Great War: Styles and Patterns of the 1910s", + "Book name"); + InitSystem(p8_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Hillhouse & Mansfield", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Marion S. Hillhouse and Evelyn A. Mansfield", + "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Dress Design: Draping and Flat Pattern Making", + "Book name"); + InitSystem(p9_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Pivnick", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Esther Kaplan Pivnick", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "How to Design Beautiful Clothes: Designing and " + "Pattern Making", "Book name"); + InitSystem(p10_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Minister & Son", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Edward Minister & Son, ed. R. L. Shep", + "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Complete Guide to Practical Cutting (1853)", + "Book name"); + InitSystem(p11_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Strickland", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Gertrude Strickland", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "A Tailoring Manual", "Book name"); + InitSystem(p12_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Loh & Lewis", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "May Loh and Diehl Lewis", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Patternless Fashion Design", "Book name"); + InitSystem(p13_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Morris, F. R.", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "F. R. Morris", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Ladies Garment Cutting and Making", "Book name"); + InitSystem(p14_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Mason", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Gertrude Mason", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Gertrude Mason's Patternmaking Book", "Book name"); + InitSystem(p15_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Kimata", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "K. Kimata", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "K.Kimata's Simplified Drafting Book for Dressmaking", + "Book name"); + InitSystem(p16_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Master Designer", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "The Master Designer (Chicago, IL)", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Master Designer's System of Designing, Cutting and " + "Grading", "Book name"); + InitSystem(p17_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Kopp", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Ernestine Kopp, Vittorina Rolfo, Beatrice Zelin, " + "Lee Gross", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "How to Draft Basic Patterns", "Book name"); + InitSystem(p18_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Ekern", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Doris Ekern", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Slacks Cut-to-Fit for Your Figure", "Book name"); + InitSystem(p19_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Doyle", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Sarah J. Doyle", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Sarah's Key to Pattern Drafting", "Book name"); + InitSystem(p20_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Shelton", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Karla J. Shelton", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Design and Sew Jeans", "Book name"); + InitSystem(p21_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Lady Boutique", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Lady Boutique", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Lady Boutique magazine (Japan)", "Book name"); + InitSystem(p22_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Rohr", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "M. Rohr", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern Drafting and Grading: Women's nd Misses' " + "Garment Design", "Book name"); + InitSystem(p23_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Moore", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Dorothy Moore", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Dorothy Moore's Pattern Drafting and Dressmaking", + "Book name"); + InitSystem(p24_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "system_P25", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "system_P25", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "system_P25", "Book name"); + InitSystem(p25_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Fukomoto", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Sue S. Fukomoto", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Scientific Pattern Drafting as taught at Style Center " + "School of Costume Design, Dressmaking and Millinery", "Book name"); + InitSystem(p26_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Dressmaking International", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Dressmaking International", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Dressmaking International magazine (Japan)", + "Book name"); + InitSystem(p27_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Erwin", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Mabel D. Erwin", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Practical Dress Design", "Book name"); + InitSystem(p28_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Gough", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "E. L. G. Gough", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Principles of Garment Cutting", "Book name"); + InitSystem(p29_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Allemong", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Elizabeth M. Allemong", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "European Cut", "Book name"); + InitSystem(p30_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "McCunn", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Donald H. McCunn", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "How to Make Your Own Sewing Patterns", "Book name"); + InitSystem(p31_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Zarapkar", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Shri K. R. Zarapkar and Shri Arvind K. Zarapkar", + "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Zarapkar System of Cutting", "Book name"); + InitSystem(p32_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Kunick", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Philip Kunick", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Sizing, Pattern Construction and Grading for Women's " + "and Children's Garments", "Book name"); + InitSystem(p33_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Handford", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Jack Handford", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Professional Patternmaking for Designers: Women's " + "Wear, Men's Casual Wear", "Book name"); + InitSystem(p34_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Davis", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "R. I. Davis", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Men's 17th & 18th Century Costume, Cut & Fashion", + "Book name"); + InitSystem(p35_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "MacLochlainn", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Jason MacLochlainn", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Victorian Tailor: An Introduction to Period " + "Tailoring", "Book name"); + InitSystem(p36_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Joseph-Armstrong", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Helen Joseph-Armstrong", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Patternmaking for Fashion Design", "Book name"); + InitSystem(p37_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Supreme System", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Frederick T. Croonberg", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Blue Book of Men's Tailoring, Grand Edition of " + "Supreme System for Producing Mens Garments (1907)", "Book name"); + InitSystem(p38_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Sugino", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Dressmaking", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern Drafting Vols. I, II, III (Japan)", + "Book name"); + InitSystem(p39_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Centre Point System", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Louis Devere", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Handbook of Practical Cutting on the Centre Point " + "System", "Book name"); + InitSystem(p40_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Aldrich/Men", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Winifred Aldrich", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Metric Pattern Cutting for Menswear", "Book name"); + InitSystem(p41_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Aldrich/Women", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Winifred Aldrich", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Metric Pattern Cutting for Women's Wear", "Book name"); + InitSystem(p42_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Kershaw", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Gareth Kershaw", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Patternmaking for Menswear", "Book name"); + InitSystem(p43_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Gilewska", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Teresa Gilewska", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern-Drafting for Fashion: The Basics", "Book name"); + InitSystem(p44_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Lo", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Dennic Chunman Lo", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern Cutting", "Book name"); + InitSystem(p45_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Bray", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Natalie Bray", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Dress Pattern Designing: The Basic Principles of Cut " + "and Fit", "Book name"); + InitSystem(p46_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Knowles/Men", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Lori A. Knowles", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Practical Guide to Patternmaking for Fashion " + "Designers: Menswear", "Book name"); + InitSystem(p47_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Friendship/Men", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Elizabeth Friendship", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern Cutting for Men's Costume", "Book name"); + InitSystem(p48_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Brown", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "P. Clement Brown", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Art in Dress", "Book name"); + InitSystem(p49_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Mitchell", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Jno. J. Mitchell", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "\"Standard\" Work on Cutting (Men's Garments) 1886: " + "The Art and Science of Garment Cutting", "Book name"); + InitSystem(p50_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "system_P51", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "system_P51", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "system_P51", "Book name"); + InitSystem(p51_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Eddy", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Josephine F. Eddy and Elizabeth C. B. Wiley", + "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Pattern and Dress Design", "Book name"); + InitSystem(p52_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "Knowles/Women", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "Lori A. Knowles", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "Practical Guide to Patternmaking for Fashion " + "Designers: Juniors, Misses, and Women", "Book name"); + InitSystem(p53_S, name, author, book); + //================================================================================================================= + name = QmuTranslation::translate("Pattern_making_systems", "American Garment Cutter", "System name"); + author = QmuTranslation::translate("Pattern_making_systems", "ed. R. L. Shep", "Author name"); + book = QmuTranslation::translate("Pattern_making_systems", "The Great War: Styles and Patterns of the 1910s", + "Book name"); + InitSystem(p54_S, name, author, book); + //================================================================================================================= +} + //--------------------------------------------------------------------------------------------------------------------- void VTranslateVars::InitVariables() { @@ -153,6 +477,15 @@ void VTranslateVars::InitMeasurement(const QString &name, const QmuTranslation & formulas.insert(name, formula); } +//--------------------------------------------------------------------------------------------------------------------- +void VTranslateVars::InitSystem(const QString &code, const QmuTranslation &name, const QmuTranslation &author, + const QmuTranslation &book) +{ + PMSystemNames.insert(code, name); + PMSystemAuthors.insert(code, author); + PMSystemBooks.insert(code, book); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief CorrectionsPositions correct position tokens in expression after token translation. @@ -387,6 +720,24 @@ QString VTranslateVars::VarFromUser(const QString &var) const return newVar; } +//--------------------------------------------------------------------------------------------------------------------- +QString VTranslateVars::PMSystemName(const QString &code) const +{ + return PMSystemNames.value(code).translate(); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VTranslateVars::PMSystemAuthor(const QString &code) const +{ + return PMSystemAuthors.value(code).translate(); +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VTranslateVars::PMSystemBook(const QString &code) const +{ + return PMSystemBooks.value(code).translate(); +} + //--------------------------------------------------------------------------------------------------------------------- QString VTranslateVars::MToUser(const QString &measurement) const { diff --git a/src/libs/vpatterndb/vtranslatevars.h b/src/libs/vpatterndb/vtranslatevars.h index 8153b671a..f6801e6c3 100644 --- a/src/libs/vpatterndb/vtranslatevars.h +++ b/src/libs/vpatterndb/vtranslatevars.h @@ -47,6 +47,10 @@ public: QString VarToUser(const QString &var) const; QString VarFromUser(const QString &var) const; + QString PMSystemName(const QString &code) const; + QString PMSystemAuthor(const QString &code) const; + QString PMSystemBook(const QString &code) const; + QString MToUser(const QString &measurement) const; QString MFromUser(const QString &measurement) const; QString MNumber(const QString &measurement) const; @@ -62,6 +66,9 @@ public: private: Q_DISABLE_COPY(VTranslateVars) QMap measurements; + QMap PMSystemNames; + QMap PMSystemAuthors; + QMap PMSystemBooks; QMap guiTexts; QMap descriptions; QMap variables; @@ -91,6 +98,7 @@ private: void InitGroupQ(); // Patternmaking measurements void InitMeasurements(); + void InitPatternMakingSystems(); void InitVariables(); void InitFunctions(); void InitPostfixOperators(); @@ -98,6 +106,8 @@ private: void InitMeasurement(const QString &name, const qmu::QmuTranslation &m, const qmu::QmuTranslation &g, const qmu::QmuTranslation &d, const QString &number, const QString &formula = QString()); + void InitSystem(const QString &code, const qmu::QmuTranslation &name, const qmu::QmuTranslation &author, + const qmu::QmuTranslation &book); void CorrectionsPositions(int position, int bias, QMap &tokens, QMap &numbers) const; static void BiasTokens(int position, int bias, QMap &tokens);