Prepare base values.
This commit is contained in:
parent
ac72a6cfa9
commit
4db0f3a420
|
@ -562,10 +562,8 @@ void TMainWindow::changeEvent(QEvent *event)
|
|||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
ui->labelMType->setText(tr("Multisize measurements"));
|
||||
ui->labelBaseSizeValue->setText(QString().setNum(m->DimensionABase()) + QChar(QChar::Space) +
|
||||
UnitsToStr(m->MUnit(), true));
|
||||
ui->labelBaseHeightValue->setText(QString().setNum(m->DimensionBBase()) + QChar(QChar::Space) +
|
||||
UnitsToStr(m->MUnit(), true));
|
||||
|
||||
RetranslateDimensionBaseValues();
|
||||
|
||||
labelGradationHeights->setText(tr("Height (%1):").arg(UnitsToStr(mUnit)));
|
||||
labelGradationSizes->setText(tr("Size (%1):").arg(UnitsToStr(mUnit)));
|
||||
|
@ -2017,7 +2015,7 @@ void TMainWindow::InitWindow()
|
|||
SCASSERT(m != nullptr)
|
||||
ui->labelToolTip->setVisible(false);
|
||||
ui->tabWidget->setVisible(true);
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
ui->tabWidget->setCurrentIndex(0); // measurements
|
||||
|
||||
ui->plainTextEditNotes->setEnabled(true);
|
||||
ui->toolBarGradation->setVisible(true);
|
||||
|
@ -2025,10 +2023,8 @@ void TMainWindow::InitWindow()
|
|||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
ui->labelMType->setText(tr("Multisize measurements"));
|
||||
ui->labelBaseSizeValue->setText(QString().setNum(m->DimensionABase()) + QChar(QChar::Space) +
|
||||
UnitsToStr(m->MUnit(), true));
|
||||
ui->labelBaseHeightValue->setText(QString().setNum(m->DimensionBBase()) + QChar(QChar::Space) +
|
||||
UnitsToStr(m->MUnit(), true));
|
||||
|
||||
InitDimensionsBaseValue();
|
||||
|
||||
// Because Qt Designer doesn't know about our deleting we will create empty objects for correct
|
||||
// working the retranslation UI
|
||||
|
@ -2091,10 +2087,14 @@ void TMainWindow::InitWindow()
|
|||
HackWidget(&ui->labelInHeights);
|
||||
|
||||
// Tab Information
|
||||
HackWidget(&ui->labelBaseSize);
|
||||
HackWidget(&ui->labelBaseSizeValue);
|
||||
HackWidget(&ui->labelBaseHeight);
|
||||
HackWidget(&ui->labelBaseHeightValue);
|
||||
HackWidget(&ui->labelDimensionA);
|
||||
HackWidget(&ui->labelDimensionABase);
|
||||
HackWidget(&ui->labelDimensionB);
|
||||
HackWidget(&ui->labelDimensionBBase);
|
||||
HackWidget(&ui->labelDimensionC);
|
||||
HackWidget(&ui->labelDimensionCBase);
|
||||
HackWidget(&ui->frameBaseValue);
|
||||
HackWidget(&ui->labelBaseValues);
|
||||
|
||||
ui->lineEditCustomerName->setText(m->Customer());
|
||||
|
||||
|
@ -2179,6 +2179,44 @@ void TMainWindow::InitWindow()
|
|||
InitTable();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::InitDimensionsBaseValue()
|
||||
{
|
||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
||||
|
||||
auto DimensionsBaseValue = [this, dimensions, unit](int index, QLabel *name, QLabel *base)
|
||||
{
|
||||
SCASSERT(name != nullptr)
|
||||
SCASSERT(base != nullptr)
|
||||
|
||||
if (dimensions.size() > index)
|
||||
{
|
||||
MeasurementDimension_p dimension = dimensions.at(index);
|
||||
name->setText(DimensionName(dimension->Type())+QChar(':'));
|
||||
name->setToolTip(DimensionToolTip(dimension->Type(), dimension->IsCircumference()));
|
||||
|
||||
if (dimension->IsCircumference() || dimension->Type() == MeasurementDimension::X)
|
||||
{
|
||||
base->setText(QString("%1 %2").arg(dimension->BaseValue()).arg(unit));
|
||||
}
|
||||
else
|
||||
{
|
||||
base->setText(QString::number(dimension->BaseValue()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HackWidget(&name);
|
||||
HackWidget(&base);
|
||||
}
|
||||
};
|
||||
|
||||
DimensionsBaseValue(0, ui->labelDimensionA, ui->labelDimensionABase);
|
||||
DimensionsBaseValue(1, ui->labelDimensionB, ui->labelDimensionBBase);
|
||||
DimensionsBaseValue(2, ui->labelDimensionC, ui->labelDimensionCBase);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::InitTable()
|
||||
{
|
||||
|
@ -3306,6 +3344,84 @@ void TMainWindow::SetCurrentPatternUnit()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString TMainWindow::DimensionName(MeasurementDimension type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case MeasurementDimension::X:
|
||||
return tr("Height");
|
||||
case MeasurementDimension::Y:
|
||||
return tr("Size");
|
||||
case MeasurementDimension::W:
|
||||
return tr("Hip");
|
||||
case MeasurementDimension::Z:
|
||||
return tr("Waist");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::RetranslateDimensionBaseValues()
|
||||
{
|
||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
||||
|
||||
auto DimensionsBaseValue = [this, dimensions, unit](int index, QLabel *name, QLabel *base)
|
||||
{
|
||||
SCASSERT(name != nullptr)
|
||||
SCASSERT(base != nullptr)
|
||||
|
||||
if (dimensions.size() > index)
|
||||
{
|
||||
MeasurementDimension_p dimension = dimensions.at(index);
|
||||
name->setText(DimensionName(dimension->Type())+QChar(':'));
|
||||
name->setToolTip(DimensionToolTip(dimension->Type(), dimension->IsCircumference()));
|
||||
|
||||
if (dimension->IsCircumference())
|
||||
{
|
||||
base->setText(QString("%1 %2").arg(dimension->BaseValue()).arg(unit));
|
||||
}
|
||||
else
|
||||
{
|
||||
base->setText(QString::number(dimension->BaseValue()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DimensionsBaseValue(0, ui->labelDimensionA, ui->labelDimensionABase);
|
||||
DimensionsBaseValue(1, ui->labelDimensionC, ui->labelDimensionCBase);
|
||||
DimensionsBaseValue(2, ui->labelDimensionB, ui->labelDimensionBBase);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString TMainWindow::DimensionToolTip(MeasurementDimension type, bool circumference)
|
||||
{
|
||||
const bool fc = m->IsFullCircumference();
|
||||
switch(type)
|
||||
{
|
||||
case MeasurementDimension::X:
|
||||
return tr("Height");
|
||||
case MeasurementDimension::Y:
|
||||
if (circumference)
|
||||
{
|
||||
return fc ? tr("Chest full circumference") : tr("Chest half circumference");
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr("Size");
|
||||
}
|
||||
return circumference ? tr("Chest circumference") : tr("Size");
|
||||
case MeasurementDimension::W:
|
||||
return fc ? tr("Hip full circumference") : tr("Hip half circumference");
|
||||
case MeasurementDimension::Z:
|
||||
return fc ? tr("Waist full circumference") : tr("Waist half circumference");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::SetDecimals()
|
||||
{
|
||||
|
|
|
@ -155,6 +155,7 @@ private:
|
|||
|
||||
void SetupMenu();
|
||||
void InitWindow();
|
||||
void InitDimensionsBaseValue();
|
||||
void InitTable();
|
||||
void SetDecimals();
|
||||
void InitUnits();
|
||||
|
@ -218,6 +219,11 @@ private:
|
|||
void ImportMultisizeMeasurements(const QxtCsvModel &csv);
|
||||
|
||||
void SetCurrentPatternUnit();
|
||||
|
||||
QString DimensionName(MeasurementDimension type);
|
||||
QString DimensionToolTip(MeasurementDimension type, bool circumference);
|
||||
|
||||
void RetranslateDimensionBaseValues();
|
||||
};
|
||||
|
||||
#endif // TMAINWINDOW_H
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>835</width>
|
||||
<height>726</height>
|
||||
<width>1034</width>
|
||||
<height>896</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -24,7 +24,7 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelToolTip">
|
||||
<property name="sizePolicy">
|
||||
|
@ -47,7 +47,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabMeasurements">
|
||||
<attribute name="icon">
|
||||
|
@ -572,7 +572,12 @@
|
|||
<attribute name="title">
|
||||
<string>Information</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_21">
|
||||
<property name="text">
|
||||
|
@ -666,41 +671,29 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelBaseSize">
|
||||
<property name="text">
|
||||
<string>Base size:</string>
|
||||
<widget class="QLabel" name="labelBaseValues">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="labelBaseSizeValue">
|
||||
<property name="text">
|
||||
<string>Base size value</string>
|
||||
<string>Base Values:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelBaseHeight">
|
||||
<property name="text">
|
||||
<string>Base height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelBaseHeightValue">
|
||||
<property name="text">
|
||||
<string>Base height value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelCustomerName">
|
||||
<property name="text">
|
||||
<string>Customer name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCustomerName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -716,20 +709,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelBirthDate">
|
||||
<property name="text">
|
||||
<string>Birth date:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QDateEdit" name="dateEditBirthDate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -758,14 +751,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelGender">
|
||||
<property name="text">
|
||||
<string>Gender:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="comboBoxGender">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -776,22 +769,16 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelEmail">
|
||||
<property name="text">
|
||||
<string>Email:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="lineEditEmail">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -807,14 +794,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelNotes">
|
||||
<property name="text">
|
||||
<string>Notes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="VPlainTextEdit" name="plainTextEditNotes">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -827,6 +814,65 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QFrame" name="frameBaseValue">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelDimensionA">
|
||||
<property name="text">
|
||||
<string notr="true">A</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelDimensionABase">
|
||||
<property name="text">
|
||||
<string notr="true">Base</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelDimensionB">
|
||||
<property name="text">
|
||||
<string notr="true">B</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelDimensionBBase">
|
||||
<property name="text">
|
||||
<string notr="true">Base</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelDimensionC">
|
||||
<property name="text">
|
||||
<string notr="true">C</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelDimensionCBase">
|
||||
<property name="text">
|
||||
<string notr="true">Base</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -838,8 +884,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>835</width>
|
||||
<height>22</height>
|
||||
<width>1034</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
Loading…
Reference in New Issue
Block a user