Dialog Preferences.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-02 18:27:18 +03:00
parent fb3b1ddc43
commit e8577487b1
34 changed files with 1400 additions and 24 deletions

View File

@ -0,0 +1,271 @@
/************************************************************************
**
** @file tapeTapeConfigurationPage.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "tapeconfigurationpage.h"
#include "../../mapplication.h"
#include "../vmisc/vtapesettings.h"
#include <QDir>
#include <QGroupBox>
#include <QLabel>
#include <QSettings>
#include <QTimer>
#include <QSpinBox>
#include <QComboBox>
#include <QMessageBox>
#include <QCheckBox>
#include <QIcon>
#include <QFormLayout>
//---------------------------------------------------------------------------------------------------------------------
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<QString>(langCombo->itemData(langCombo->currentIndex()));
qApp->TapeSettings()->SetLocale(locale);
langChanged = false;
const QString code = qvariant_cast<QString>(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<void (QComboBox::*)(int)>(&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<void (QComboBox::*)(int)>(&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);
}

View File

@ -0,0 +1,74 @@
/************************************************************************
**
** @file tapeconfigurationpage.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef CONFIGURATIONPAGE_H
#define CONFIGURATIONPAGE_H
#include <QObject>
#include <QWidget>
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

View File

@ -0,0 +1,207 @@
/************************************************************************
**
** @file tapepathpage.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "tapepathpage.h"
#include "../../mapplication.h"
#include "../vmisc/vtapesettings.h"
#include <QDir>
#include <QGroupBox>
#include <QLabel>
#include <QSettings>
#include <QTimer>
#include <QSpinBox>
#include <QComboBox>
#include <QMessageBox>
#include <QCheckBox>
#include <QIcon>
#include <QVBoxLayout>
#include <QTableWidget>
#include <QPushButton>
#include <QFileDialog>
#include <QHeaderView>
//---------------------------------------------------------------------------------------------------------------------
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);
}

View File

@ -0,0 +1,58 @@
/************************************************************************
**
** @file tapepathpage.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef PATHPAGE_H
#define PATHPAGE_H
#include <QObject>
#include <QWidget>
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

View File

@ -0,0 +1,158 @@
/************************************************************************
**
** @file tapeconfigdialog.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#include "tapeconfigdialog.h"
#include <QListWidget>
#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QStackedWidget>
#include <QCloseEvent>
#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);
}

View File

@ -0,0 +1,64 @@
/************************************************************************
**
** @file tapeconfigdialog.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @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
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
#include <QDialog>
#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

View File

@ -41,6 +41,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(theme); Q_INIT_RESOURCE(theme);
Q_INIT_RESOURCE(icon); Q_INIT_RESOURCE(icon);
Q_INIT_RESOURCE(schema); Q_INIT_RESOURCE(schema);
Q_INIT_RESOURCE(flags);
QT_REQUIRE_VERSION(argc, argv, "5.0.0"); QT_REQUIRE_VERSION(argc, argv, "5.0.0");

View File

@ -97,6 +97,12 @@ MApplication::~MApplication()
TMainWindow *window = mainWindows.at(i); TMainWindow *window = mainWindows.at(i);
delete window; delete window;
} }
delete trVars;
if (not dataBase.isNull())
{
delete dataBase;
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -140,6 +146,24 @@ void MApplication::InitOptions()
qDebug()<<"Command-line arguments:"<<this->arguments(); qDebug()<<"Command-line arguments:"<<this->arguments();
qDebug()<<"Process ID:"<<this->applicationPid(); qDebug()<<"Process ID:"<<this->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(); const QString checkedLocale = TapeSettings()->GetLocale();
qDebug()<<"Checked locale:"<<checkedLocale; qDebug()<<"Checked locale:"<<checkedLocale;
@ -163,19 +187,13 @@ void MApplication::InitOptions()
appTranslator->load("valentina_" + checkedLocale, translationsPath()); appTranslator->load("valentina_" + checkedLocale, translationsPath());
installTranslator(appTranslator); 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. 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() void MApplication::InitTrVars()
{ {
if (trVars != nullptr)
{
delete trVars;
trVars = nullptr;
}
trVars = new VTranslateVars(TapeSettings()->GetOsSeparator()); trVars = new VTranslateVars(TapeSettings()->GetOsSeparator());
} }
@ -216,7 +239,7 @@ QString MApplication::translationsPath() const
} }
else else
{ {
return QApplication::applicationDirPath() + "../../valentina/bin" + trPath; return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath;
} }
#else #else
#ifdef QT_DEBUG #ifdef QT_DEBUG
@ -227,7 +250,7 @@ QString MApplication::translationsPath() const
} }
else else
{ {
return QApplication::applicationDirPath() + "../../valentina/bin" + trPath; return QApplication::applicationDirPath() + "/../../valentina/bin" + trPath;
} }
#else #else
QDir dir1(QApplication::applicationDirPath() + trPath); QDir dir1(QApplication::applicationDirPath() + trPath);
@ -236,7 +259,7 @@ QString MApplication::translationsPath() const
return dir1.absolutePath(); return dir1.absolutePath();
} }
QDir dir2(QApplication::applicationDirPath() + "../../valentina/bin" + trPath); QDir dir2(QApplication::applicationDirPath() + "/../../valentina/bin" + trPath);
if (dir2.exists()) if (dir2.exists())
{ {
return dir2.absolutePath(); return dir2.absolutePath();

View File

@ -61,6 +61,7 @@ public:
#endif #endif
void InitOptions(); void InitOptions();
void LoadTranslation();
virtual const VTranslateVars *TrVars(); virtual const VTranslateVars *TrVars();
void InitTrVars(); void InitTrVars();

View File

@ -8,7 +8,10 @@ SOURCES += \
$$PWD/mapplication.cpp \ $$PWD/mapplication.cpp \
$$PWD/dialogs/dialogabouttape.cpp \ $$PWD/dialogs/dialogabouttape.cpp \
$$PWD/dialogs/dialognewmeasurements.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 += \ HEADERS += \
$$PWD/tmainwindow.h \ $$PWD/tmainwindow.h \
@ -17,7 +20,10 @@ HEADERS += \
$$PWD/dialogs/dialogabouttape.h \ $$PWD/dialogs/dialogabouttape.h \
$$PWD/dialogs/dialognewmeasurements.h \ $$PWD/dialogs/dialognewmeasurements.h \
$$PWD/dialogs/dialogmdatabase.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 += \ FORMS += \
$$PWD/tmainwindow.ui \ $$PWD/tmainwindow.ui \

View File

@ -31,6 +31,7 @@
#include "dialogs/dialogabouttape.h" #include "dialogs/dialogabouttape.h"
#include "dialogs/dialognewmeasurements.h" #include "dialogs/dialognewmeasurements.h"
#include "dialogs/dialogmdatabase.h" #include "dialogs/dialogmdatabase.h"
#include "dialogs/tapeconfigdialog.h"
#include "../vpatterndb/calculator.h" #include "../vpatterndb/calculator.h"
#include "../ifc/ifcdef.h" #include "../ifc/ifcdef.h"
#include "../ifc/xml/vvitconverter.h" #include "../ifc/xml/vvitconverter.h"
@ -1150,6 +1151,13 @@ void TMainWindow::NewWindow()
qApp->MainWindow()->activateWindow(); qApp->MainWindow()->activateWindow();
} }
//---------------------------------------------------------------------------------------------------------------------
void TMainWindow::Preferences()
{
TapeConfigDialog dlg(this);
dlg.exec();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::SetupMenu() void TMainWindow::SetupMenu()
{ {
@ -1168,6 +1176,7 @@ void TMainWindow::SetupMenu()
ui->actionSaveAs->setShortcuts(QKeySequence::SaveAs); ui->actionSaveAs->setShortcuts(QKeySequence::SaveAs);
connect(ui->actionReadOnly, &QAction::triggered, this, &TMainWindow::ReadOnly); connect(ui->actionReadOnly, &QAction::triggered, this, &TMainWindow::ReadOnly);
connect(ui->actionPreferences, &QAction::triggered, this, &TMainWindow::Preferences);
connect(ui->actionQuit, &QAction::triggered, this, &TMainWindow::close); connect(ui->actionQuit, &QAction::triggered, this, &TMainWindow::close);
ui->actionQuit->setShortcuts(QKeySequence::Quit); ui->actionQuit->setShortcuts(QKeySequence::Quit);

View File

@ -107,6 +107,8 @@ private slots:
void NewWindow(); void NewWindow();
void Preferences();
private: private:
Q_DISABLE_COPY(TMainWindow) Q_DISABLE_COPY(TMainWindow)
Ui::TMainWindow *ui; Ui::TMainWindow *ui;

View File

@ -595,6 +595,8 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionReadOnly"/> <addaction name="actionReadOnly"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionPreferences"/>
<addaction name="separator"/>
<addaction name="actionQuit"/> <addaction name="actionQuit"/>
</widget> </widget>
<widget class="QMenu" name="menuWindow"> <widget class="QMenu" name="menuWindow">
@ -793,6 +795,11 @@
<string>Show information about all known measurement</string> <string>Show information about all known measurement</string>
</property> </property>
</action> </action>
<action name="actionPreferences">
<property name="text">
<string>Preferences</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>

View File

@ -51,7 +51,6 @@ include(valentina.pri)
RESOURCES += \ RESOURCES += \
share/resources/cursor.qrc \ # Tools cursor icons. share/resources/cursor.qrc \ # Tools cursor icons.
share/resources/measurements.qrc \ # For measurements files that we save as resource. share/resources/measurements.qrc \ # For measurements files that we save as resource.
share/resources/flags.qrc \
share/resources/toolicon.qrc share/resources/toolicon.qrc
# Compilation will fail without this files after we added them to this section. # Compilation will fail without this files after we added them to this section.

View File

@ -286,6 +286,63 @@ const QString dartWidthShoulder_M = QStringLiteral("dart_width_shoulder"); // Q0
const QString dartWidthBust_M = QStringLiteral("dart_width_bust"); // Q02 const QString dartWidthBust_M = QStringLiteral("dart_width_bust"); // Q02
const QString dartWidthWaist_M = QStringLiteral("dart_width_waist"); // Q03 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 //variables
const QString line_ = QStringLiteral("Line_"); const QString line_ = QStringLiteral("Line_");
const QString angleLine_ = QStringLiteral("AngleLine_"); const QString angleLine_ = QStringLiteral("AngleLine_");

View File

@ -454,6 +454,66 @@ extern const QString dartWidthShoulder_M; // Q01
extern const QString dartWidthBust_M; // Q02 extern const QString dartWidthBust_M; // Q02
extern const QString dartWidthWaist_M; // Q03 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 // variables name
extern const QString line_; extern const QString line_;
extern const QString angleLine_; extern const QString angleLine_;

View File

Before

Width:  |  Height:  |  Size: 818 B

After

Width:  |  Height:  |  Size: 818 B

View File

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 111 B

View File

Before

Width:  |  Height:  |  Size: 851 B

After

Width:  |  Height:  |  Size: 851 B

View File

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 509 B

View File

Before

Width:  |  Height:  |  Size: 107 B

After

Width:  |  Height:  |  Size: 107 B

View File

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 637 B

View File

Before

Width:  |  Height:  |  Size: 110 B

After

Width:  |  Height:  |  Size: 110 B

View File

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

View File

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 520 B

View File

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 312 B

View File

Before

Width:  |  Height:  |  Size: 509 B

After

Width:  |  Height:  |  Size: 509 B

View File

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 144 B

View File

@ -49,6 +49,7 @@ const QString VCommonSettings::SettingConfigurationAutosaveState = QString
const QString VCommonSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time"); const QString VCommonSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString VCommonSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state"); const QString VCommonSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
const QString VCommonSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale"); const QString VCommonSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VCommonSettings::SettingPMSystemCode = QStringLiteral("configuration/pmscode");
const QString VCommonSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit"); const QString VCommonSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VCommonSettings::SettingConfigurationConfirmItemDeletion const QString VCommonSettings::SettingConfigurationConfirmItemDeletion
= QStringLiteral("configuration/confirm_item_deletion"); = QStringLiteral("configuration/confirm_item_deletion");
@ -161,6 +162,18 @@ void VCommonSettings::SetLocale(const QString &value)
setValue(SettingConfigurationLocale, 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 QString VCommonSettings::GetUnit() const
{ {

View File

@ -62,6 +62,9 @@ public:
QString GetLocale() const; QString GetLocale() const;
void SetLocale(const QString &value); void SetLocale(const QString &value);
QString GetPMSystemCode() const;
void SetPMSystemCode(const QString &value);
QString GetUnit() const; QString GetUnit() const;
void SetUnit(const QString &value); void SetUnit(const QString &value);
@ -102,6 +105,7 @@ private:
static const QString SettingConfigurationAutosaveTime; static const QString SettingConfigurationAutosaveTime;
static const QString SettingConfigurationSendReportState; static const QString SettingConfigurationSendReportState;
static const QString SettingConfigurationLocale; static const QString SettingConfigurationLocale;
static const QString SettingPMSystemCode;
static const QString SettingConfigurationUnit; static const QString SettingConfigurationUnit;
static const QString SettingConfigurationConfirmItemDeletion; static const QString SettingConfigurationConfirmItemDeletion;
static const QString SettingConfigurationToolBarStyle; static const QString SettingConfigurationToolBarStyle;

View File

@ -31,7 +31,8 @@ include(vmisc.pri)
# Resource files. This files will be included in binary. # Resource files. This files will be included in binary.
RESOURCES += \ RESOURCES += \
share/resources/theme.qrc \ # Windows theme icons. 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" # This is static library so no need in "make install"

View File

@ -35,13 +35,22 @@ using namespace qmu;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTranslateVars::VTranslateVars(bool osSeparator) VTranslateVars::VTranslateVars(bool osSeparator)
:measurements(QMap<QString, QmuTranslation>()), guiTexts(QMap<QString, QmuTranslation>()), :measurements(QMap<QString, QmuTranslation>()),
descriptions(QMap<QString, QmuTranslation>()), variables(QMap<QString, QmuTranslation>()), PMSystemNames(QMap<QString, QmuTranslation>()),
functions(QMap<QString, QmuTranslation>()), postfixOperators(QMap<QString, QmuTranslation>()), PMSystemAuthors(QMap<QString, QmuTranslation>()),
stDescriptions(QMap<QString, QmuTranslation>()), numbers(QMap<QString, QString>()), PMSystemBooks(QMap<QString, QmuTranslation>()),
formulas(QMap<QString, QString>()), osSeparator(osSeparator) guiTexts(QMap<QString, QmuTranslation>()),
descriptions(QMap<QString, QmuTranslation>()),
variables(QMap<QString, QmuTranslation>()),
functions(QMap<QString, QmuTranslation>()),
postfixOperators(QMap<QString, QmuTranslation>()),
stDescriptions(QMap<QString, QmuTranslation>()),
numbers(QMap<QString, QString>()),
formulas(QMap<QString, QString>()),
osSeparator(osSeparator)
{ {
InitMeasurements(); InitMeasurements();
InitPatternMakingSystems();
InitVariables(); InitVariables();
InitFunctions(); InitFunctions();
InitPostfixOperators(); InitPostfixOperators();
@ -74,6 +83,321 @@ void VTranslateVars::InitMeasurements()
InitGroupQ(); // Patternmaking measurements 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() void VTranslateVars::InitVariables()
{ {
@ -153,6 +477,15 @@ void VTranslateVars::InitMeasurement(const QString &name, const QmuTranslation &
formulas.insert(name, formula); 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. * @brief CorrectionsPositions correct position tokens in expression after token translation.
@ -387,6 +720,24 @@ QString VTranslateVars::VarFromUser(const QString &var) const
return newVar; 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 QString VTranslateVars::MToUser(const QString &measurement) const
{ {

View File

@ -47,6 +47,10 @@ public:
QString VarToUser(const QString &var) const; QString VarToUser(const QString &var) const;
QString VarFromUser(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 MToUser(const QString &measurement) const;
QString MFromUser(const QString &measurement) const; QString MFromUser(const QString &measurement) const;
QString MNumber(const QString &measurement) const; QString MNumber(const QString &measurement) const;
@ -62,6 +66,9 @@ public:
private: private:
Q_DISABLE_COPY(VTranslateVars) Q_DISABLE_COPY(VTranslateVars)
QMap<QString, qmu::QmuTranslation> measurements; QMap<QString, qmu::QmuTranslation> measurements;
QMap<QString, qmu::QmuTranslation> PMSystemNames;
QMap<QString, qmu::QmuTranslation> PMSystemAuthors;
QMap<QString, qmu::QmuTranslation> PMSystemBooks;
QMap<QString, qmu::QmuTranslation> guiTexts; QMap<QString, qmu::QmuTranslation> guiTexts;
QMap<QString, qmu::QmuTranslation> descriptions; QMap<QString, qmu::QmuTranslation> descriptions;
QMap<QString, qmu::QmuTranslation> variables; QMap<QString, qmu::QmuTranslation> variables;
@ -91,6 +98,7 @@ private:
void InitGroupQ(); // Patternmaking measurements void InitGroupQ(); // Patternmaking measurements
void InitMeasurements(); void InitMeasurements();
void InitPatternMakingSystems();
void InitVariables(); void InitVariables();
void InitFunctions(); void InitFunctions();
void InitPostfixOperators(); void InitPostfixOperators();
@ -98,6 +106,8 @@ private:
void InitMeasurement(const QString &name, const qmu::QmuTranslation &m, const qmu::QmuTranslation &g, void InitMeasurement(const QString &name, const qmu::QmuTranslation &m, const qmu::QmuTranslation &g,
const qmu::QmuTranslation &d, const QString &number, const QString &formula = QString()); 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<int, QString> &tokens, QMap<int, QString> &numbers) const; void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens, QMap<int, QString> &numbers) const;
static void BiasTokens(int position, int bias, QMap<int, QString> &tokens); static void BiasTokens(int position, int bias, QMap<int, QString> &tokens);