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),
|
||||
osOptionCheck(nullptr),
|
||||
langChanged(false),
|
||||
systemChanged(),
|
||||
unitChanged(false),
|
||||
labelLangChanged(false),
|
||||
sendReportCheck(nullptr),
|
||||
|
@ -66,6 +67,13 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
|||
separatorLabel(nullptr),
|
||||
unitLabel(nullptr),
|
||||
languageLabel(nullptr),
|
||||
pmSystemGroup(nullptr),
|
||||
systemLabel(nullptr),
|
||||
systemCombo(nullptr),
|
||||
systemAuthorLabel(nullptr),
|
||||
systemBookLabel(nullptr),
|
||||
systemAuthorValueLabel(nullptr),
|
||||
systemBookValueLabel(nullptr),
|
||||
sendGroup(nullptr),
|
||||
description(nullptr),
|
||||
drawGroup(nullptr),
|
||||
|
@ -73,6 +81,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
|||
{
|
||||
QGroupBox *saveGroup = SaveGroup();
|
||||
QGroupBox *langGroup = LangGroup();
|
||||
QGroupBox *pmSystemGroup = PMSystemGroup();
|
||||
QGroupBox *sendGroup = SendGroup();
|
||||
QGroupBox *drawGroup = DrawGroup();
|
||||
QGroupBox *toolBarGroup = ToolBarGroup();
|
||||
|
@ -80,6 +89,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent)
|
|||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(saveGroup);
|
||||
mainLayout->addWidget(langGroup);
|
||||
mainLayout->addWidget(pmSystemGroup);
|
||||
mainLayout->addWidget(sendGroup);
|
||||
mainLayout->addWidget(drawGroup);
|
||||
mainLayout->addWidget(toolBarGroup);
|
||||
|
@ -111,6 +121,12 @@ void ConfigurationPage::Apply()
|
|||
langChanged = false;
|
||||
qApp->LoadTranslation(locale);
|
||||
}
|
||||
if (systemChanged)
|
||||
{
|
||||
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
|
||||
settings->SetPMSystemCode(code);
|
||||
systemChanged = false;
|
||||
}
|
||||
if (this->unitChanged)
|
||||
{
|
||||
const QString unit = qvariant_cast<QString>(this->unitCombo->itemData(this->unitCombo->currentIndex()));
|
||||
|
@ -267,6 +283,49 @@ QGroupBox *ConfigurationPage::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()
|
||||
{
|
||||
|
@ -322,6 +381,26 @@ QGroupBox *ConfigurationPage::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)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define CONFIGURATIONPAGE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QWidget>
|
||||
|
||||
class QCheckBox;
|
||||
|
@ -46,6 +47,7 @@ public:
|
|||
void Apply();
|
||||
public slots:
|
||||
void LangChanged();
|
||||
void SystemChanged();
|
||||
void UnitChanged();
|
||||
void LabelLangChanged();
|
||||
protected:
|
||||
|
@ -59,6 +61,7 @@ private:
|
|||
QComboBox *unitCombo;
|
||||
QCheckBox *osOptionCheck;
|
||||
bool langChanged;
|
||||
bool systemChanged;
|
||||
bool unitChanged;
|
||||
bool labelLangChanged;
|
||||
QCheckBox *sendReportCheck;
|
||||
|
@ -73,6 +76,14 @@ private:
|
|||
QLabel *unitLabel;
|
||||
QLabel *languageLabel;
|
||||
|
||||
QGroupBox *pmSystemGroup;
|
||||
QLabel *systemLabel;
|
||||
QComboBox *systemCombo;
|
||||
QLabel *systemAuthorLabel;
|
||||
QLabel *systemBookLabel;
|
||||
QLabel *systemAuthorValueLabel;
|
||||
QPlainTextEdit *systemBookValueLabel;
|
||||
|
||||
QGroupBox *sendGroup;
|
||||
QLabel *description;
|
||||
|
||||
|
@ -81,6 +92,7 @@ private:
|
|||
|
||||
QGroupBox *SaveGroup();
|
||||
QGroupBox *LangGroup();
|
||||
QGroupBox *PMSystemGroup();
|
||||
QGroupBox *SendGroup();
|
||||
QGroupBox *DrawGroup();
|
||||
QGroupBox *ToolBarGroup();
|
||||
|
|
Loading…
Reference in New Issue
Block a user