Dialog setup miltisize measurements.
This commit is contained in:
parent
054560c7a0
commit
484b92a38e
|
@ -38,8 +38,7 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
|||
: QWidget(parent),
|
||||
ui(new Ui::TapePreferencesConfigurationPage),
|
||||
m_langChanged(false),
|
||||
m_systemChanged(false),
|
||||
m_defGradationChanged(false)
|
||||
m_systemChanged(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
RetranslateUi();
|
||||
|
@ -84,31 +83,6 @@ TapePreferencesConfigurationPage::TapePreferencesConfigurationPage(QWidget *pare
|
|||
|
||||
//----------------------- Toolbar
|
||||
ui->toolBarStyleCheck->setChecked(qApp->TapeSettings()->GetToolBarStyle());
|
||||
|
||||
//---------------------------Default height and size
|
||||
// If change units don't forget about the label
|
||||
ui->defHeightCombo->addItems(VMeasurement::WholeListHeights(Unit::Cm));
|
||||
index = ui->defHeightCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefHeight()));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->defHeightCombo->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
auto DefGradationChanged = [this]()
|
||||
{
|
||||
m_defGradationChanged = true;
|
||||
};
|
||||
|
||||
connect(ui->defHeightCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
||||
|
||||
// If change units don't forget about the label
|
||||
ui->defSizeCombo->addItems(VMeasurement::WholeListSizes(Unit::Cm));
|
||||
index = ui->defSizeCombo->findText(QString().setNum(qApp->TapeSettings()->GetDefSize()));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->defSizeCombo->setCurrentIndex(index);
|
||||
}
|
||||
connect(ui->defSizeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, DefGradationChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -150,13 +124,6 @@ QStringList TapePreferencesConfigurationPage::Apply()
|
|||
qApp->RetranslateGroups();
|
||||
}
|
||||
|
||||
if (m_defGradationChanged)
|
||||
{
|
||||
settings->SetDefHeight(ui->defHeightCombo->currentText().toInt());
|
||||
settings->SetDefSize(ui->defSizeCombo->currentText().toInt());
|
||||
m_defGradationChanged = false;
|
||||
}
|
||||
|
||||
return preferences;
|
||||
}
|
||||
|
||||
|
@ -187,7 +154,4 @@ void TapePreferencesConfigurationPage::RetranslateUi()
|
|||
ui->systemCombo->blockSignals(false);
|
||||
ui->systemCombo->setCurrentIndex(ui->systemCombo->findData(code));
|
||||
}
|
||||
|
||||
ui->labelHeightUnit->setText(UnitsToStr(Unit::Cm, true));
|
||||
ui->labelSizeUnit->setText(UnitsToStr(Unit::Cm, true));
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ private:
|
|||
Ui::TapePreferencesConfigurationPage *ui;
|
||||
bool m_langChanged;
|
||||
bool m_systemChanged;
|
||||
bool m_defGradationChanged;
|
||||
|
||||
void RetranslateUi();
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>750</height>
|
||||
<height>648</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -25,7 +25,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>524</width>
|
||||
<height>730</height>
|
||||
<height>628</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -165,89 +165,6 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Default height and size</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Default height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="defSizeCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="labelHeightUnit">
|
||||
<property name="text">
|
||||
<string notr="true">Height unit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="defHeightCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="labelSizeUnit">
|
||||
<property name="text">
|
||||
<string notr="true">Size unit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Default size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
|
|
|
@ -44,31 +44,7 @@ DialogNewMeasurements::DialogNewMeasurements(QWidget *parent)
|
|||
ui->setupUi(this);
|
||||
|
||||
InitMTypes();
|
||||
InitUnits(MeasurementsType::Individual);
|
||||
InitHeightsList();
|
||||
InitSizesList();
|
||||
|
||||
const VTapeSettings *settings = qApp->TapeSettings();
|
||||
|
||||
const int height = static_cast<int>(UnitConvertor(settings->GetDefHeight(), Unit::Cm, MUnit()));
|
||||
int index = ui->comboBoxBaseHeight->findText(QString().setNum(height));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxBaseHeight->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
const int size = static_cast<int>(UnitConvertor(settings->GetDefSize(), Unit::Cm, MUnit()));
|
||||
index = ui->comboBoxBaseSize->findText(QString().setNum(size));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxBaseSize->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
connect(ui->comboBoxMType, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogNewMeasurements::CurrentTypeChanged);
|
||||
|
||||
connect(ui->comboBoxUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&DialogNewMeasurements::CurrentUnitChanged);
|
||||
InitUnits();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -89,18 +65,6 @@ Unit DialogNewMeasurements::MUnit() const
|
|||
return static_cast<Unit>(ui->comboBoxUnit->currentData().toInt());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogNewMeasurements::BaseSize() const
|
||||
{
|
||||
return ui->comboBoxBaseSize->currentText().toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int DialogNewMeasurements::BaseHeight() const
|
||||
{
|
||||
return ui->comboBoxBaseHeight->currentText().toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::changeEvent(QEvent *event)
|
||||
{
|
||||
|
@ -109,7 +73,7 @@ void DialogNewMeasurements::changeEvent(QEvent *event)
|
|||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
InitMTypes();
|
||||
InitUnits(static_cast<MeasurementsType>(ui->comboBoxMType->currentData().toInt()));
|
||||
InitUnits();
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
|
@ -137,40 +101,6 @@ void DialogNewMeasurements::showEvent(QShowEvent *event)
|
|||
isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::CurrentTypeChanged(int index)
|
||||
{
|
||||
const MeasurementsType type = static_cast<MeasurementsType>(ui->comboBoxMType->itemData(index).toInt());
|
||||
if (type == MeasurementsType::Multisize)
|
||||
{
|
||||
ui->comboBoxBaseSize->setEnabled(true);
|
||||
ui->comboBoxBaseHeight->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->comboBoxBaseSize->setEnabled(false);
|
||||
ui->comboBoxBaseHeight->setEnabled(false);
|
||||
}
|
||||
InitUnits(type);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::CurrentUnitChanged(int index)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
|
||||
if (MUnit() != Unit::Inch)
|
||||
{
|
||||
int i = ui->comboBoxBaseHeight->currentIndex();
|
||||
InitHeightsList();
|
||||
ui->comboBoxBaseHeight->setCurrentIndex(i);
|
||||
|
||||
i = ui->comboBoxBaseSize->currentIndex();
|
||||
InitSizesList();
|
||||
ui->comboBoxBaseSize->setCurrentIndex(i);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitMTypes()
|
||||
{
|
||||
|
@ -194,23 +124,7 @@ void DialogNewMeasurements::InitMTypes()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitHeightsList()
|
||||
{
|
||||
const QStringList list = VMeasurement::WholeListHeights(MUnit());
|
||||
ui->comboBoxBaseHeight->clear();
|
||||
ui->comboBoxBaseHeight->addItems(list);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitSizesList()
|
||||
{
|
||||
const QStringList list = VMeasurement::WholeListSizes(MUnit());
|
||||
ui->comboBoxBaseSize->clear();
|
||||
ui->comboBoxBaseSize->addItems(list);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
|
||||
void DialogNewMeasurements::InitUnits()
|
||||
{
|
||||
int val = static_cast<int>(Unit::Cm);
|
||||
if (ui->comboBoxUnit->currentIndex() != -1)
|
||||
|
@ -220,12 +134,11 @@ void DialogNewMeasurements::InitUnits(const MeasurementsType &type)
|
|||
|
||||
ui->comboBoxUnit->blockSignals(true);
|
||||
ui->comboBoxUnit->clear();
|
||||
|
||||
ui->comboBoxUnit->addItem(tr("Centimeters"), static_cast<int>(Unit::Cm));
|
||||
ui->comboBoxUnit->addItem(tr("Millimiters"), static_cast<int>(Unit::Mm));
|
||||
if (type == MeasurementsType::Individual)
|
||||
{
|
||||
ui->comboBoxUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
|
||||
}
|
||||
ui->comboBoxUnit->addItem(tr("Inches"), static_cast<int>(Unit::Inch));
|
||||
|
||||
ui->comboBoxUnit->setCurrentIndex(-1);
|
||||
ui->comboBoxUnit->blockSignals(false);
|
||||
|
||||
|
|
|
@ -48,26 +48,18 @@ public:
|
|||
|
||||
MeasurementsType Type() const;
|
||||
Unit MUnit() const;
|
||||
int BaseSize() const;
|
||||
int BaseHeight() const;
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void CurrentTypeChanged(int index);
|
||||
void CurrentUnitChanged(int index);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogNewMeasurements)
|
||||
Ui::DialogNewMeasurements *ui;
|
||||
bool isInitialized;
|
||||
|
||||
void InitMTypes();
|
||||
void InitHeightsList();
|
||||
void InitSizesList();
|
||||
void InitUnits(const MeasurementsType &type);
|
||||
void InitUnits();
|
||||
};
|
||||
|
||||
#endif // DIALOGNEWMEASUREMENTS_H
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>244</width>
|
||||
<height>185</height>
|
||||
<width>220</width>
|
||||
<height>104</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -60,64 +60,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Base size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxBaseSize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Base height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxBaseHeight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
597
src/app/tape/dialogs/dialogsetupmultisize.cpp
Normal file
597
src/app/tape/dialogs/dialogsetupmultisize.cpp
Normal file
|
@ -0,0 +1,597 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogsetupmultisize.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 26 9, 2020
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2020 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/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 "dialogsetupmultisize.h"
|
||||
#include "ui_dialogsetupmultisize.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include "../mapplication.h"
|
||||
#include "../vmisc/backport/qoverload.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSetupMultisize::DialogSetupMultisize(Unit unit, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogSetupMultisize),
|
||||
m_xDimension(QSharedPointer<VXMeasurementDimension>::create(unit)),
|
||||
m_yDimension(QSharedPointer<VYMeasurementDimension>::create(unit)),
|
||||
m_wDimension(QSharedPointer<VWMeasurementDimension>::create(unit)),
|
||||
m_zDimension(QSharedPointer<VZMeasurementDimension>::create(unit))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->labelError->clear();
|
||||
ui->checkBoxYDimensionCircumference->setChecked(m_yDimension->IsCircumference());
|
||||
|
||||
InitXDimension();
|
||||
InitYDimension();
|
||||
InitWDimension();
|
||||
InitZDimension();
|
||||
|
||||
// height
|
||||
connect(ui->spinBoxXDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
||||
ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->spinBoxXDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxXDimensionMinValue, ui->comboBoxXDimensionStep,
|
||||
ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxXDimensionStep, ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
connect(ui->comboBoxXDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxXDimensionBase, m_xDimension);
|
||||
});
|
||||
|
||||
// size
|
||||
connect(ui->spinBoxYDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->spinBoxYDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxYDimensionMinValue, ui->comboBoxYDimensionStep,
|
||||
ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
connect(ui->comboBoxYDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
});
|
||||
|
||||
// hip
|
||||
connect(ui->spinBoxWDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
||||
ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->spinBoxWDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxWDimensionMinValue, ui->comboBoxWDimensionStep,
|
||||
ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
connect(ui->comboBoxWDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
});
|
||||
|
||||
// waist
|
||||
connect(ui->spinBoxZDimensionMinValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMinValueChanged(value, ui->spinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
||||
ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->spinBoxZDimensionMaxValue, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, [this](int value)
|
||||
{
|
||||
DimensionMaxValueChanged(value, ui->spinBoxZDimensionMinValue, ui->comboBoxZDimensionStep,
|
||||
ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->comboBoxZDimensionStep, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionStepChanged(index, ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
connect(ui->comboBoxZDimensionBase, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, [this](int index)
|
||||
{
|
||||
DimensionBaseChanged(index, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
});
|
||||
|
||||
|
||||
connect(ui->groupBoxXDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxYDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxWDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
connect(ui->groupBoxZDimension, &QGroupBox::clicked, this, [this](){CheckState();});
|
||||
|
||||
connect(ui->checkBoxFullCircumference, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::ShowFullCircumference);
|
||||
connect(ui->checkBoxYDimensionCircumference, &QCheckBox::stateChanged,
|
||||
this, &DialogSetupMultisize::YDimensionCircumferenceChanged);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogSetupMultisize::~DialogSetupMultisize()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<QSharedPointer<VAbstartMeasurementDimension> > DialogSetupMultisize::Dimensions() const
|
||||
{
|
||||
QVector<QSharedPointer<VAbstartMeasurementDimension> > dimensions;
|
||||
|
||||
if (ui->groupBoxXDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_xDimension);
|
||||
}
|
||||
|
||||
if (ui->groupBoxYDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_yDimension);
|
||||
}
|
||||
|
||||
if (ui->groupBoxWDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_wDimension);
|
||||
}
|
||||
|
||||
if (ui->groupBoxZDimension->isChecked())
|
||||
{
|
||||
dimensions.append(m_zDimension);
|
||||
}
|
||||
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
{
|
||||
// retranslate designer form (single inheritance approach)
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
// remember to call base class implementation
|
||||
QDialog::changeEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::showEvent(QShowEvent *event)
|
||||
{
|
||||
QDialog::showEvent( event );
|
||||
if ( event->spontaneous() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_isInitialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// do your init stuff here
|
||||
|
||||
setMaximumSize(size());
|
||||
setMinimumSize(size());
|
||||
|
||||
m_isInitialized = true;//first show windows are held
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::ShowFullCircumference()
|
||||
{
|
||||
auto ShowDimensionFullCircumference = [this](QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue,
|
||||
QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMinValue != nullptr)
|
||||
SCASSERT(spinboxMaxValue != nullptr)
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
InitDimension(spinboxMinValue, spinboxMaxValue, comboBoxStep, dimension);
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
comboBoxBase->blockSignals(true);
|
||||
comboBoxBase->setCurrentIndex(-1);
|
||||
comboBoxBase->blockSignals(false);
|
||||
};
|
||||
|
||||
ShowDimensionFullCircumference(ui->spinBoxYDimensionMinValue, ui->spinBoxYDimensionMaxValue,
|
||||
ui->comboBoxYDimensionStep, ui->comboBoxYDimensionBase, m_yDimension);
|
||||
ShowDimensionFullCircumference(ui->spinBoxWDimensionMinValue, ui->spinBoxWDimensionMaxValue,
|
||||
ui->comboBoxWDimensionStep, ui->comboBoxWDimensionBase, m_wDimension);
|
||||
ShowDimensionFullCircumference(ui->spinBoxZDimensionMinValue, ui->spinBoxZDimensionMaxValue,
|
||||
ui->comboBoxZDimensionStep, ui->comboBoxZDimensionBase, m_zDimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::YDimensionCircumferenceChanged()
|
||||
{
|
||||
bool checked = ui->checkBoxYDimensionCircumference->isChecked();
|
||||
m_yDimension->SetCircumference(checked);
|
||||
|
||||
const bool c = m_yDimension->IsCircumference();
|
||||
const QString unitStr = c ? " " + UnitsToStr(m_yDimension->Units()) : QString();
|
||||
|
||||
ui->spinBoxYDimensionMinValue->setSuffix(unitStr);
|
||||
ui->spinBoxYDimensionMaxValue->setSuffix(unitStr);
|
||||
|
||||
InitDimension(ui->spinBoxYDimensionMinValue, ui->spinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
m_yDimension);
|
||||
|
||||
UpdateBase(ui->comboBoxYDimensionBase, m_yDimension);
|
||||
|
||||
ui->comboBoxYDimensionBase->blockSignals(true);
|
||||
ui->comboBoxYDimensionBase->setCurrentIndex(-1);
|
||||
ui->comboBoxYDimensionBase->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int base = ui->comboBoxYDimensionBase->currentData().toInt(&ok);
|
||||
m_yDimension->SetBaseValue(ok ? base : -1);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::CheckState()
|
||||
{
|
||||
ui->labelError->clear();
|
||||
|
||||
bool xDimensionValid = true;
|
||||
bool yDimensionValid = true;
|
||||
bool wDimensionValid = true;
|
||||
bool zDimensionValid = true;
|
||||
|
||||
int dimensions = 0;
|
||||
|
||||
auto CheckDimension = [this](QGroupBox *group, bool &dimensionValid, int &dimensions,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(group != nullptr)
|
||||
|
||||
if (group->isChecked())
|
||||
{
|
||||
dimensionValid = dimension->IsValid();
|
||||
++dimensions;
|
||||
|
||||
if (ui->labelError->text().isEmpty() && not dimensionValid)
|
||||
{
|
||||
ui->labelError->setText(tr("Please, provide correct data for dimensions"));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CheckDimension(ui->groupBoxXDimension, xDimensionValid, dimensions, m_xDimension);
|
||||
CheckDimension(ui->groupBoxYDimension, yDimensionValid, dimensions, m_yDimension);
|
||||
CheckDimension(ui->groupBoxWDimension, wDimensionValid, dimensions, m_wDimension);
|
||||
CheckDimension(ui->groupBoxZDimension, zDimensionValid, dimensions, m_zDimension);
|
||||
|
||||
if (ui->labelError->text().isEmpty() && dimensions == 0)
|
||||
{
|
||||
ui->labelError->setText(tr("Please, select at least one dimension"));
|
||||
}
|
||||
else if (ui->labelError->text().isEmpty() && dimensions > 3)
|
||||
{
|
||||
ui->labelError->setText(tr("No more than 3 dimensions allowed"));
|
||||
}
|
||||
|
||||
const bool enough = dimensions > 0 && dimensions <= 3;
|
||||
|
||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
SCASSERT(bOk != nullptr)
|
||||
bOk->setEnabled(enough && xDimensionValid && yDimensionValid && wDimensionValid && zDimensionValid);
|
||||
|
||||
if (ui->labelError->text().isEmpty())
|
||||
{
|
||||
ui->labelError->setText(tr("Ready"));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimensionMinMax(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMinValue != nullptr)
|
||||
SCASSERT(spinboxMaxValue != nullptr)
|
||||
|
||||
dimension->SetMinValue(dimension->RangeMin());
|
||||
dimension->SetMaxValue(dimension->RangeMax());
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
spinboxMinValue->blockSignals(true);
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
if (c)
|
||||
{
|
||||
spinboxMinValue->setSuffix(unitStr);
|
||||
}
|
||||
|
||||
spinboxMinValue->setMinimum(c && fc ? dimension->RangeMin()*2 : dimension->RangeMin());
|
||||
spinboxMinValue->setMaximum(c && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||
spinboxMinValue->setValue(c && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||
spinboxMinValue->blockSignals(false);
|
||||
|
||||
spinboxMaxValue->blockSignals(true);
|
||||
if (c)
|
||||
{
|
||||
spinboxMaxValue->setSuffix(unitStr);
|
||||
}
|
||||
spinboxMaxValue->setMinimum(c && fc ? dimension->MinValue()*2 : dimension->MinValue());
|
||||
spinboxMaxValue->setMaximum(c && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||
spinboxMaxValue->setValue(c && fc ? dimension->RangeMax()*2 : dimension->RangeMax());
|
||||
spinboxMaxValue->setValue(c && fc ? dimension->MaxValue()*2 : dimension->MaxValue());
|
||||
spinboxMaxValue->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimensionStep(QComboBox *comboBoxStep,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
|
||||
dimension->SetStep(-1);
|
||||
|
||||
comboBoxStep->blockSignals(true);
|
||||
const QVector<int> steps = dimension->ValidSteps();
|
||||
comboBoxStep->clear();
|
||||
for(auto step : steps)
|
||||
{
|
||||
comboBoxStep->addItem(QString("%1%2").arg(c && fc ? step*2 : step)
|
||||
.arg(c ? unitStr : QString()), step);
|
||||
}
|
||||
|
||||
comboBoxStep->setCurrentIndex(-1); // force a user to select
|
||||
comboBoxStep->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int step = comboBoxStep->currentData().toInt(&ok);
|
||||
dimension->SetStep(ok ? step : -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitDimension(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
InitDimensionMinMax(spinboxMinValue, spinboxMaxValue, dimension);
|
||||
InitDimensionStep(comboBoxStep, dimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitXDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxXDimensionMinValue, ui->spinBoxXDimensionMaxValue, ui->comboBoxXDimensionStep,
|
||||
m_xDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitYDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxYDimensionMinValue, ui->spinBoxYDimensionMaxValue, ui->comboBoxYDimensionStep,
|
||||
m_yDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitWDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxWDimensionMinValue, ui->spinBoxWDimensionMaxValue, ui->comboBoxWDimensionStep,
|
||||
m_wDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::InitZDimension()
|
||||
{
|
||||
InitDimension(ui->spinBoxZDimensionMinValue, ui->spinBoxZDimensionMaxValue, ui->comboBoxZDimensionStep,
|
||||
m_zDimension);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionMinValueChanged(int value, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMaxValue != nullptr)
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
dimension->SetMinValue(c && fc ? value / 2 : value);
|
||||
|
||||
spinboxMaxValue->blockSignals(true);
|
||||
spinboxMaxValue->setMinimum(value);
|
||||
spinboxMaxValue->blockSignals(false);
|
||||
|
||||
dimension->SetMaxValue(c && fc ? spinboxMaxValue->value() / 2 : spinboxMaxValue->value());
|
||||
|
||||
UpdateSteps(comboBoxStep, dimension);
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionMaxValueChanged(int value, QSpinBox *spinboxMinValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(spinboxMinValue != nullptr)
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
dimension->SetMaxValue(c && fc ? value / 2 : value);
|
||||
|
||||
spinboxMinValue->blockSignals(true);
|
||||
spinboxMinValue->setMaximum(value);
|
||||
spinboxMinValue->blockSignals(false);
|
||||
|
||||
dimension->SetMinValue(c && fc ? spinboxMinValue->value() / 2 : spinboxMinValue->value());
|
||||
|
||||
UpdateSteps(comboBoxStep, dimension);
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
bool ok = false;
|
||||
const int step = comboBoxStep->itemData(index).toInt(&ok);
|
||||
dimension->SetStep(ok ? step : -1);
|
||||
|
||||
UpdateBase(comboBoxBase, dimension);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::DimensionBaseChanged(int index, QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
bool ok = false;
|
||||
const int base = comboBoxBase->itemData(index).toInt(&ok);
|
||||
dimension->SetBaseValue(ok ? base : -1);
|
||||
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::UpdateSteps(QComboBox *comboBoxStep,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxStep != nullptr)
|
||||
|
||||
int oldStep = -1;
|
||||
if (comboBoxStep->currentIndex() != -1)
|
||||
{
|
||||
oldStep = comboBoxStep->currentData().toInt();
|
||||
}
|
||||
|
||||
comboBoxStep->blockSignals(true);
|
||||
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
const QVector<int> steps = dimension->ValidSteps();
|
||||
comboBoxStep->clear();
|
||||
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
for(auto step : steps)
|
||||
{
|
||||
comboBoxStep->addItem(QString("%1%2").arg(c && fc ? step * 2 : step)
|
||||
.arg(c ? unitStr : QString()), step);
|
||||
}
|
||||
|
||||
comboBoxStep->setCurrentIndex(comboBoxStep->findData(oldStep));
|
||||
comboBoxStep->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int step = comboBoxStep->currentData().toInt(&ok);
|
||||
dimension->SetStep(ok ? step : -1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSetupMultisize::UpdateBase(QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension)
|
||||
{
|
||||
SCASSERT(comboBoxBase != nullptr)
|
||||
|
||||
int oldBase = -1;
|
||||
if (comboBoxBase->currentIndex() != -1)
|
||||
{
|
||||
oldBase = comboBoxBase->currentData().toInt();
|
||||
}
|
||||
|
||||
comboBoxBase->blockSignals(true);
|
||||
|
||||
const QString unitStr = " " + UnitsToStr(dimension->Units());
|
||||
const QVector<int> bases = dimension->ValidBases();
|
||||
comboBoxBase->clear();
|
||||
const bool fc = ui->checkBoxFullCircumference->isChecked();
|
||||
const bool c = dimension->IsCircumference();
|
||||
|
||||
for(auto base : bases)
|
||||
{
|
||||
comboBoxBase->addItem(QString("%1%2").arg(c && fc ? base * 2 : base).arg(c ? unitStr : QString()), base);
|
||||
}
|
||||
|
||||
comboBoxBase->setCurrentIndex(comboBoxBase->findData(oldBase));
|
||||
comboBoxBase->blockSignals(false);
|
||||
|
||||
bool ok = false;
|
||||
const int base = comboBoxBase->currentData().toInt(&ok);
|
||||
dimension->SetBaseValue(ok ? base : -1);
|
||||
}
|
||||
|
99
src/app/tape/dialogs/dialogsetupmultisize.h
Normal file
99
src/app/tape/dialogs/dialogsetupmultisize.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogsetupmultisize.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 26 9, 2020
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2020 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/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 DIALOGSETUPMULTISIZE_H
|
||||
#define DIALOGSETUPMULTISIZE_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../vformat/vdimensions.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
class QSpinBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogSetupMultisize;
|
||||
}
|
||||
|
||||
class DialogSetupMultisize : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogSetupMultisize(Unit unit, QWidget *parent = nullptr);
|
||||
~DialogSetupMultisize();
|
||||
|
||||
QVector<QSharedPointer<VAbstartMeasurementDimension> > Dimensions() const;
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void ShowFullCircumference();
|
||||
void YDimensionCircumferenceChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSetupMultisize)
|
||||
Ui::DialogSetupMultisize *ui;
|
||||
bool m_isInitialized{false};
|
||||
QSharedPointer<VXMeasurementDimension> m_xDimension;
|
||||
QSharedPointer<VYMeasurementDimension> m_yDimension;
|
||||
QSharedPointer<VWMeasurementDimension> m_wDimension;
|
||||
QSharedPointer<VZMeasurementDimension> m_zDimension;
|
||||
|
||||
void CheckState();
|
||||
|
||||
void InitDimensionMinMax(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
void InitDimensionStep(QComboBox *comboBoxStep,const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
|
||||
void InitDimension(QSpinBox *spinboxMinValue, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
void InitXDimension();
|
||||
void InitYDimension();
|
||||
void InitWDimension();
|
||||
void InitZDimension();
|
||||
|
||||
void DimensionMinValueChanged(int value, QSpinBox *spinboxMaxValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
void DimensionMaxValueChanged(int value, QSpinBox *spinboxMinValue, QComboBox *comboBoxStep,
|
||||
QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
|
||||
void DimensionStepChanged(int index, QComboBox *comboBoxStep, QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
void DimensionBaseChanged(int index, QComboBox *comboBoxBase,
|
||||
const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
|
||||
void UpdateSteps(QComboBox *comboBoxStep, const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
void UpdateBase(QComboBox *comboBoxBase, const QSharedPointer<VAbstartMeasurementDimension> &dimension);
|
||||
};
|
||||
|
||||
#endif // DIALOGSETUPMULTISIZE_H
|
480
src/app/tape/dialogs/dialogsetupmultisize.ui
Normal file
480
src/app/tape/dialogs/dialogsetupmultisize.ui
Normal file
|
@ -0,0 +1,480 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogSetupMultisize</class>
|
||||
<widget class="QDialog" name="DialogSetupMultisize">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>734</width>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Setup multisize measurements</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../share/resources/tapeicon.qrc">
|
||||
<normaloff>:/tapeicon/64x64/logo.png</normaloff>:/tapeicon/64x64/logo.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxFullCircumference">
|
||||
<property name="text">
|
||||
<string>Use full circumference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxXDimension">
|
||||
<property name="title">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxXDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxXDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxXDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxXDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxYDimension">
|
||||
<property name="title">
|
||||
<string>Size</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxYDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxYDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxYDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxYDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxYDimensionCircumference">
|
||||
<property name="text">
|
||||
<string>Circumference</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxWDimension">
|
||||
<property name="title">
|
||||
<string>Hip</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_5">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxWDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxWDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxWDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxWDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxZDimension">
|
||||
<property name="title">
|
||||
<string>Waist</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Min value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxZDimensionMinValue">
|
||||
<property name="toolTip">
|
||||
<string>Minimal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Max value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxZDimensionMaxValue">
|
||||
<property name="toolTip">
|
||||
<string>Maximal value described in the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Step:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxZDimensionStep">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Single-step between the column values</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Base:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxZDimensionBase">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The base value for the column</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelError">
|
||||
<property name="text">
|
||||
<string notr="true">_</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>groupBoxXDimension</tabstop>
|
||||
<tabstop>spinBoxXDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxXDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxXDimensionStep</tabstop>
|
||||
<tabstop>comboBoxXDimensionBase</tabstop>
|
||||
<tabstop>groupBoxYDimension</tabstop>
|
||||
<tabstop>spinBoxYDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxYDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxYDimensionStep</tabstop>
|
||||
<tabstop>comboBoxYDimensionBase</tabstop>
|
||||
<tabstop>groupBoxWDimension</tabstop>
|
||||
<tabstop>spinBoxWDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxWDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxWDimensionStep</tabstop>
|
||||
<tabstop>comboBoxWDimensionBase</tabstop>
|
||||
<tabstop>groupBoxZDimension</tabstop>
|
||||
<tabstop>spinBoxZDimensionMinValue</tabstop>
|
||||
<tabstop>spinBoxZDimensionMaxValue</tabstop>
|
||||
<tabstop>comboBoxZDimensionStep</tabstop>
|
||||
<tabstop>comboBoxZDimensionBase</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../share/resources/tapeicon.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogSetupMultisize</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>746</x>
|
||||
<y>383</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogSetupMultisize</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>746</x>
|
||||
<y>383</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -11,7 +11,8 @@ SOURCES += \
|
|||
$$PWD/vlitepattern.cpp \
|
||||
$$PWD/dialogs/dialogtapepreferences.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.cpp \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.cpp \
|
||||
$$PWD/dialogs/dialogsetupmultisize.cpp
|
||||
|
||||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
|
@ -26,7 +27,8 @@ HEADERS += \
|
|||
$$PWD/vlitepattern.h \
|
||||
$$PWD/dialogs/dialogtapepreferences.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.h \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.h \
|
||||
$$PWD/dialogs/dialogsetupmultisize.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tmainwindow.ui \
|
||||
|
@ -35,4 +37,5 @@ FORMS += \
|
|||
$$PWD/dialogs/dialogmdatabase.ui \
|
||||
$$PWD/dialogs/dialogtapepreferences.ui \
|
||||
$$PWD/dialogs/configpages/tapepreferencesconfigurationpage.ui \
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.ui
|
||||
$$PWD/dialogs/configpages/tapepreferencespathpage.ui \
|
||||
$$PWD/dialogs/dialogsetupmultisize.ui
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "dialogs/dialognewmeasurements.h"
|
||||
#include "dialogs/dialogmdatabase.h"
|
||||
#include "dialogs/dialogtapepreferences.h"
|
||||
#include "dialogs/dialogsetupmultisize.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/calculator.h"
|
||||
#include "../vpatterndb/pmsystems.h"
|
||||
|
@ -371,13 +372,24 @@ void TMainWindow::FileNew()
|
|||
pUnit = mUnit;
|
||||
mType = measurements.Type();
|
||||
|
||||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
DialogSetupMultisize setup(mUnit, this);
|
||||
if (setup.exec() == QDialog::Rejected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return; // temporary
|
||||
|
||||
data = new VContainer(qApp->TrVars(), &mUnit, VContainer::UniqueNamespace());
|
||||
currentHeight = measurements.BaseHeight();
|
||||
currentSize = measurements.BaseSize();
|
||||
// currentHeight = measurements.BaseHeight();
|
||||
// currentSize = measurements.BaseSize();
|
||||
|
||||
if (mType == MeasurementsType::Multisize)
|
||||
{
|
||||
m = new VMeasurements(mUnit, measurements.BaseSize(), measurements.BaseHeight(), data);
|
||||
m = new VMeasurements(mUnit, /*measurements.BaseSize(), measurements.BaseHeight(),*/ data);
|
||||
m_curFileFormatVersion = VVSTConverter::MeasurementMaxVer;
|
||||
m_curFileFormatVersionStr = VVSTConverter::MeasurementMaxVerStr;
|
||||
}
|
||||
|
|
372
src/libs/vformat/vdimensions.cpp
Normal file
372
src/libs/vformat/vdimensions.cpp
Normal file
|
@ -0,0 +1,372 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vdimensions.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 9, 2020
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2020 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/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 "vdimensions.h"
|
||||
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstartMeasurementDimension::VAbstartMeasurementDimension(Unit units)
|
||||
: m_units(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstartMeasurementDimension::VAbstartMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: m_units(units),
|
||||
m_minValue(min),
|
||||
m_maxValue(max),
|
||||
m_step(step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsValid()
|
||||
{
|
||||
m_error.clear();
|
||||
return IsUnitsValid() && IsRangeValid() && IsStepValid() && IsBaseValid();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> VAbstartMeasurementDimension::ValidSteps() const
|
||||
{
|
||||
QVector<int> steps;
|
||||
|
||||
const int diff = m_maxValue - m_minValue;
|
||||
if (diff == 0)
|
||||
{
|
||||
steps.append(0); // only one possible value
|
||||
}
|
||||
else if (diff > 0)
|
||||
{
|
||||
steps.append(1);
|
||||
|
||||
auto AddStep = [&steps, diff](int step)
|
||||
{
|
||||
if (diff % step == 0)
|
||||
{
|
||||
steps.append(step);
|
||||
}
|
||||
};
|
||||
|
||||
for (int i=2; i < 9; ++i)
|
||||
{
|
||||
AddStep(i);
|
||||
}
|
||||
}
|
||||
|
||||
return steps;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<int> VAbstartMeasurementDimension::ValidBases() const
|
||||
{
|
||||
QVector<int> validBases;
|
||||
int step = Step();
|
||||
|
||||
if (step < 0)
|
||||
{
|
||||
return validBases;
|
||||
}
|
||||
else if (step == 0)
|
||||
{
|
||||
step = 1;
|
||||
}
|
||||
|
||||
for (int value = MinValue(); value <= MaxValue(); value += step)
|
||||
{
|
||||
validBases.append(value);
|
||||
}
|
||||
|
||||
return validBases;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QStringList VAbstartMeasurementDimension::ValidBasesList() const
|
||||
{
|
||||
QVector<int> bases = ValidBases();
|
||||
QStringList list;
|
||||
for(auto &base : bases)
|
||||
{
|
||||
list.append(QString::number(base));
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsRangeValid()
|
||||
{
|
||||
bool valid = m_minValue > 0 && m_maxValue > 0 && m_minValue >= RangeMin() && m_minValue <= RangeMax()
|
||||
&& m_minValue <= m_maxValue;
|
||||
|
||||
if (not valid)
|
||||
{
|
||||
m_error = tr("Invalid min/max range");
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsStepValid()
|
||||
{
|
||||
bool valid = ValidSteps().indexOf(m_step) != -1;
|
||||
if (not valid)
|
||||
{
|
||||
m_error = tr("Invalid step");
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsBaseValid()
|
||||
{
|
||||
bool valid = ValidBases().indexOf(m_baseValue) != -1;
|
||||
if (not valid)
|
||||
{
|
||||
m_error = tr("Base value invalid");
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VAbstartMeasurementDimension::IsUnitsValid()
|
||||
{
|
||||
return m_units == Unit::Cm || m_units == Unit::Mm || m_units == Unit::Inch;
|
||||
}
|
||||
|
||||
// VXMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VXMeasurementDimension::VXMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VXMeasurementDimension::VXMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VXMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::X;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VXMeasurementDimension::RangeMin() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 50;
|
||||
case Unit::Mm:
|
||||
return 500;
|
||||
case Unit::Inch:
|
||||
return 19;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VXMeasurementDimension::RangeMax() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 272;
|
||||
case Unit::Mm:
|
||||
return 2720;
|
||||
case Unit::Inch:
|
||||
return 107;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// VYMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VYMeasurementDimension::VYMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VYMeasurementDimension::VYMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VYMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::Y;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VYMeasurementDimension::RangeMin() const
|
||||
{
|
||||
if (m_circumference)
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 22;
|
||||
case Unit::Mm:
|
||||
return 220;
|
||||
case Unit::Inch:
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VYMeasurementDimension::RangeMax() const
|
||||
{
|
||||
if (m_circumference)
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 72;
|
||||
case Unit::Mm:
|
||||
return 720;
|
||||
case Unit::Inch:
|
||||
return 29;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 58;
|
||||
}
|
||||
}
|
||||
|
||||
// VWMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VWMeasurementDimension::VWMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VWMeasurementDimension::VWMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VWMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::W;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VWMeasurementDimension::RangeMin() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 33;
|
||||
case Unit::Mm:
|
||||
return 330;
|
||||
case Unit::Inch:
|
||||
return 12;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VWMeasurementDimension::RangeMax() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 63;
|
||||
case Unit::Mm:
|
||||
return 630;
|
||||
case Unit::Inch:
|
||||
return 25;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// VZMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VZMeasurementDimension::VZMeasurementDimension(Unit units)
|
||||
: VAbstartMeasurementDimension(units)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VZMeasurementDimension::VZMeasurementDimension(Unit units, int min, int max, int step)
|
||||
: VAbstartMeasurementDimension(units, min, max, step)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MeasurementDimension VZMeasurementDimension::Type() const
|
||||
{
|
||||
return MeasurementDimension::Z;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VZMeasurementDimension::RangeMin() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 33;
|
||||
case Unit::Mm:
|
||||
return 330;
|
||||
case Unit::Inch:
|
||||
return 12;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VZMeasurementDimension::RangeMax() const
|
||||
{
|
||||
switch(m_units)
|
||||
{
|
||||
case Unit::Cm:
|
||||
return 63;
|
||||
case Unit::Mm:
|
||||
return 630;
|
||||
case Unit::Inch:
|
||||
return 25;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
248
src/libs/vformat/vdimensions.h
Normal file
248
src/libs/vformat/vdimensions.h
Normal file
|
@ -0,0 +1,248 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vdimensions.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 9, 2020
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2020 Valentina project
|
||||
** <https://gitlab.com/smart-pattern/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 VDIMENSIONS_H
|
||||
#define VDIMENSIONS_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
|
||||
enum class MeasurementDimension: qint8
|
||||
{
|
||||
X, // height
|
||||
Y, // size (chest half circumference)
|
||||
W, // hip half circumference
|
||||
Z // waist half circumference
|
||||
};
|
||||
|
||||
|
||||
class VAbstartMeasurementDimension
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VAbstartMeasurementDimension)
|
||||
public:
|
||||
VAbstartMeasurementDimension() =default;
|
||||
explicit VAbstartMeasurementDimension(Unit units);
|
||||
VAbstartMeasurementDimension(Unit units, int min, int max, int step);
|
||||
virtual ~VAbstartMeasurementDimension() =default;
|
||||
|
||||
virtual MeasurementDimension Type() const =0;
|
||||
|
||||
virtual bool IsValid();
|
||||
|
||||
int MinValue() const;
|
||||
void SetMinValue(int minValue);
|
||||
|
||||
int MaxValue() const;
|
||||
void SetMaxValue(int maxValue);
|
||||
|
||||
int Step() const;
|
||||
void SetStep(int step);
|
||||
|
||||
int BaseValue() const;
|
||||
void SetBaseValue(int baseValue);
|
||||
|
||||
QString Error() const;
|
||||
|
||||
Unit Units() const;
|
||||
|
||||
virtual bool IsCircumference() const;
|
||||
|
||||
virtual int RangeMin() const =0;
|
||||
virtual int RangeMax() const =0;
|
||||
|
||||
QVector<int> ValidSteps() const;
|
||||
QVector<int> ValidBases() const;
|
||||
QStringList ValidBasesList() const;
|
||||
|
||||
protected:
|
||||
Unit m_units{Unit::Cm};
|
||||
int m_minValue{0};
|
||||
int m_maxValue{0};
|
||||
int m_step{-1};
|
||||
int m_baseValue{0};
|
||||
QString m_error{};
|
||||
|
||||
bool IsRangeValid();
|
||||
bool IsStepValid();
|
||||
bool IsBaseValid();
|
||||
bool IsUnitsValid();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::MinValue() const
|
||||
{
|
||||
return m_minValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetMinValue(int minValue)
|
||||
{
|
||||
m_minValue = minValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::MaxValue() const
|
||||
{
|
||||
return m_maxValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetMaxValue(int maxValue)
|
||||
{
|
||||
m_maxValue = maxValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::Step() const
|
||||
{
|
||||
return m_step;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetStep(int step)
|
||||
{
|
||||
m_step = step;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline int VAbstartMeasurementDimension::BaseValue() const
|
||||
{
|
||||
return m_baseValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VAbstartMeasurementDimension::SetBaseValue(int baseValue)
|
||||
{
|
||||
m_baseValue = baseValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline QString VAbstartMeasurementDimension::Error() const
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline Unit VAbstartMeasurementDimension::Units() const
|
||||
{
|
||||
return m_units;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VAbstartMeasurementDimension::IsCircumference() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// VXMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VXMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VXMeasurementDimension() =default;
|
||||
explicit VXMeasurementDimension(Unit units);
|
||||
VXMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
|
||||
virtual bool IsCircumference() const override;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VXMeasurementDimension::IsCircumference() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// VYMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VYMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VYMeasurementDimension() =default;
|
||||
explicit VYMeasurementDimension(Unit units);
|
||||
VYMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
|
||||
virtual bool IsCircumference() const override;
|
||||
void SetCircumference(bool circumference);
|
||||
|
||||
private:
|
||||
bool m_circumference{true};
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool VYMeasurementDimension::IsCircumference() const
|
||||
{
|
||||
return m_circumference;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline void VYMeasurementDimension::SetCircumference(bool circumference)
|
||||
{
|
||||
m_circumference = circumference;
|
||||
}
|
||||
|
||||
// VWMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VWMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VWMeasurementDimension() =default;
|
||||
explicit VWMeasurementDimension(Unit units);
|
||||
VWMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
};
|
||||
|
||||
// VZMeasurementDimension
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
class VZMeasurementDimension : public VAbstartMeasurementDimension
|
||||
{
|
||||
public:
|
||||
VZMeasurementDimension() =default;
|
||||
explicit VZMeasurementDimension(Unit units);
|
||||
VZMeasurementDimension(Unit units, int min, int max, int step);
|
||||
|
||||
virtual MeasurementDimension Type() const override;
|
||||
|
||||
virtual int RangeMin() const override;
|
||||
virtual int RangeMax() const override;
|
||||
};
|
||||
|
||||
#endif // VDIMENSIONS_H
|
|
@ -2,6 +2,7 @@
|
|||
# This need for corect working file translations.pro
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vdimensions.cpp \
|
||||
$$PWD/vmeasurements.cpp \
|
||||
$$PWD/vlabeltemplate.cpp \
|
||||
$$PWD/vpatternrecipe.cpp \
|
||||
|
@ -10,6 +11,7 @@ SOURCES += \
|
|||
*msvc*:SOURCES += $$PWD/stable.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/vdimensions.h \
|
||||
$$PWD/vmeasurements.h \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/vlabeltemplate.h \
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
namespace
|
||||
{
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDataBaseGeometry, (QLatin1String("database/geometry")))
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefHeight, (QLatin1String("gradation/defHeight")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDefSize, (QLatin1String("gradation/defSize")))
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -60,27 +57,3 @@ void VTapeSettings::SetDataBaseGeometry(const QByteArray &value)
|
|||
{
|
||||
setValue(*settingDataBaseGeometry, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTapeSettings::SetDefHeight(int value)
|
||||
{
|
||||
setValue(*settingDefHeight, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VTapeSettings::GetDefHeight() const
|
||||
{
|
||||
return value(*settingDefHeight, 176).toInt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VTapeSettings::SetDefSize(int value)
|
||||
{
|
||||
setValue(*settingDefSize, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VTapeSettings::GetDefSize() const
|
||||
{
|
||||
return value(*settingDefSize, 50).toInt();
|
||||
}
|
||||
|
|
|
@ -49,12 +49,6 @@ public:
|
|||
QByteArray GetDataBaseGeometry() const;
|
||||
void SetDataBaseGeometry(const QByteArray &value);
|
||||
|
||||
void SetDefHeight(int value);
|
||||
int GetDefHeight() const;
|
||||
|
||||
void SetDefSize(int value);
|
||||
int GetDefSize() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VTapeSettings)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user