Change pattern making system in Valentina settings
--HG-- branch : feature
This commit is contained in:
parent
e2cfd3f3f7
commit
a4e1db90e8
|
@ -54,6 +54,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
unitCombo(nullptr),
|
unitCombo(nullptr),
|
||||||
osOptionCheck(nullptr),
|
osOptionCheck(nullptr),
|
||||||
langChanged(false),
|
langChanged(false),
|
||||||
|
systemChanged(),
|
||||||
unitChanged(false),
|
unitChanged(false),
|
||||||
labelLangChanged(false),
|
labelLangChanged(false),
|
||||||
sendReportCheck(nullptr),
|
sendReportCheck(nullptr),
|
||||||
|
@ -66,6 +67,13 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
separatorLabel(nullptr),
|
separatorLabel(nullptr),
|
||||||
unitLabel(nullptr),
|
unitLabel(nullptr),
|
||||||
languageLabel(nullptr),
|
languageLabel(nullptr),
|
||||||
|
pmSystemGroup(nullptr),
|
||||||
|
systemLabel(nullptr),
|
||||||
|
systemCombo(nullptr),
|
||||||
|
systemAuthorLabel(nullptr),
|
||||||
|
systemBookLabel(nullptr),
|
||||||
|
systemAuthorValueLabel(nullptr),
|
||||||
|
systemBookValueLabel(nullptr),
|
||||||
sendGroup(nullptr),
|
sendGroup(nullptr),
|
||||||
description(nullptr),
|
description(nullptr),
|
||||||
drawGroup(nullptr),
|
drawGroup(nullptr),
|
||||||
|
@ -73,6 +81,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
QGroupBox *saveGroup = SaveGroup();
|
QGroupBox *saveGroup = SaveGroup();
|
||||||
QGroupBox *langGroup = LangGroup();
|
QGroupBox *langGroup = LangGroup();
|
||||||
|
QGroupBox *pmSystemGroup = PMSystemGroup();
|
||||||
QGroupBox *sendGroup = SendGroup();
|
QGroupBox *sendGroup = SendGroup();
|
||||||
QGroupBox *drawGroup = DrawGroup();
|
QGroupBox *drawGroup = DrawGroup();
|
||||||
QGroupBox *toolBarGroup = ToolBarGroup();
|
QGroupBox *toolBarGroup = ToolBarGroup();
|
||||||
|
@ -80,6 +89,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addWidget(saveGroup);
|
mainLayout->addWidget(saveGroup);
|
||||||
mainLayout->addWidget(langGroup);
|
mainLayout->addWidget(langGroup);
|
||||||
|
mainLayout->addWidget(pmSystemGroup);
|
||||||
mainLayout->addWidget(sendGroup);
|
mainLayout->addWidget(sendGroup);
|
||||||
mainLayout->addWidget(drawGroup);
|
mainLayout->addWidget(drawGroup);
|
||||||
mainLayout->addWidget(toolBarGroup);
|
mainLayout->addWidget(toolBarGroup);
|
||||||
|
@ -111,6 +121,12 @@ void ConfigurationPage::Apply()
|
||||||
langChanged = false;
|
langChanged = false;
|
||||||
qApp->LoadTranslation(locale);
|
qApp->LoadTranslation(locale);
|
||||||
}
|
}
|
||||||
|
if (systemChanged)
|
||||||
|
{
|
||||||
|
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
|
||||||
|
settings->SetPMSystemCode(code);
|
||||||
|
systemChanged = false;
|
||||||
|
}
|
||||||
if (this->unitChanged)
|
if (this->unitChanged)
|
||||||
{
|
{
|
||||||
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
||||||
|
@ -267,6 +283,49 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
return langGroup;
|
return langGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QGroupBox *ConfigurationPage::PMSystemGroup()
|
||||||
|
{
|
||||||
|
pmSystemGroup = new QGroupBox(tr("Pattern making system"));
|
||||||
|
|
||||||
|
systemLabel = new QLabel(tr("Pattern making system:"));
|
||||||
|
systemCombo = new QComboBox;
|
||||||
|
|
||||||
|
InitPMSystems(systemCombo);
|
||||||
|
|
||||||
|
QFormLayout *pmSystemLayout = new QFormLayout;
|
||||||
|
pmSystemLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
|
pmSystemLayout->addRow(systemLabel, systemCombo);
|
||||||
|
|
||||||
|
//----
|
||||||
|
systemAuthorLabel = new QLabel(tr("Author:"));
|
||||||
|
systemAuthorValueLabel = new QLabel("");
|
||||||
|
|
||||||
|
pmSystemLayout->addRow(systemAuthorLabel, systemAuthorValueLabel);
|
||||||
|
|
||||||
|
//----
|
||||||
|
systemBookLabel = new QLabel(tr("Book:"));
|
||||||
|
systemBookValueLabel = new QPlainTextEdit("");
|
||||||
|
systemBookValueLabel->setReadOnly(true);
|
||||||
|
systemBookValueLabel->setFixedHeight(4 * QFontMetrics(systemBookValueLabel->font()).lineSpacing());
|
||||||
|
|
||||||
|
pmSystemLayout->addRow(systemBookLabel, systemBookValueLabel);
|
||||||
|
|
||||||
|
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ConfigurationPage::SystemChanged);
|
||||||
|
|
||||||
|
// set default pattern making system
|
||||||
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
const int index = systemCombo->findData(settings->GetPMSystemCode());
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
systemCombo->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
pmSystemGroup->setLayout(pmSystemLayout);
|
||||||
|
return pmSystemGroup;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGroupBox *ConfigurationPage::SendGroup()
|
QGroupBox *ConfigurationPage::SendGroup()
|
||||||
{
|
{
|
||||||
|
@ -322,6 +381,26 @@ QGroupBox *ConfigurationPage::ToolBarGroup()
|
||||||
return toolBarGroup;
|
return toolBarGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ConfigurationPage::SystemChanged()
|
||||||
|
{
|
||||||
|
systemChanged = true;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||||
|
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||||
|
#else
|
||||||
|
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
|
||||||
|
#endif
|
||||||
|
systemAuthorValueLabel->setText(text);
|
||||||
|
systemAuthorValueLabel->setToolTip(text);
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||||
|
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
|
||||||
|
#else
|
||||||
|
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
|
||||||
|
#endif
|
||||||
|
systemBookValueLabel->setPlainText(text);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void ConfigurationPage::SetLabelComboBox(const QStringList &list)
|
void ConfigurationPage::SetLabelComboBox(const QStringList &list)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#define CONFIGURATIONPAGE_H
|
#define CONFIGURATIONPAGE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
@ -46,6 +47,7 @@ public:
|
||||||
void Apply();
|
void Apply();
|
||||||
public slots:
|
public slots:
|
||||||
void LangChanged();
|
void LangChanged();
|
||||||
|
void SystemChanged();
|
||||||
void UnitChanged();
|
void UnitChanged();
|
||||||
void LabelLangChanged();
|
void LabelLangChanged();
|
||||||
protected:
|
protected:
|
||||||
|
@ -59,6 +61,7 @@ private:
|
||||||
QComboBox *unitCombo;
|
QComboBox *unitCombo;
|
||||||
QCheckBox *osOptionCheck;
|
QCheckBox *osOptionCheck;
|
||||||
bool langChanged;
|
bool langChanged;
|
||||||
|
bool systemChanged;
|
||||||
bool unitChanged;
|
bool unitChanged;
|
||||||
bool labelLangChanged;
|
bool labelLangChanged;
|
||||||
QCheckBox *sendReportCheck;
|
QCheckBox *sendReportCheck;
|
||||||
|
@ -73,6 +76,14 @@ private:
|
||||||
QLabel *unitLabel;
|
QLabel *unitLabel;
|
||||||
QLabel *languageLabel;
|
QLabel *languageLabel;
|
||||||
|
|
||||||
|
QGroupBox *pmSystemGroup;
|
||||||
|
QLabel *systemLabel;
|
||||||
|
QComboBox *systemCombo;
|
||||||
|
QLabel *systemAuthorLabel;
|
||||||
|
QLabel *systemBookLabel;
|
||||||
|
QLabel *systemAuthorValueLabel;
|
||||||
|
QPlainTextEdit *systemBookValueLabel;
|
||||||
|
|
||||||
QGroupBox *sendGroup;
|
QGroupBox *sendGroup;
|
||||||
QLabel *description;
|
QLabel *description;
|
||||||
|
|
||||||
|
@ -81,6 +92,7 @@ private:
|
||||||
|
|
||||||
QGroupBox *SaveGroup();
|
QGroupBox *SaveGroup();
|
||||||
QGroupBox *LangGroup();
|
QGroupBox *LangGroup();
|
||||||
|
QGroupBox *PMSystemGroup();
|
||||||
QGroupBox *SendGroup();
|
QGroupBox *SendGroup();
|
||||||
QGroupBox *DrawGroup();
|
QGroupBox *DrawGroup();
|
||||||
QGroupBox *ToolBarGroup();
|
QGroupBox *ToolBarGroup();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user