Merged dismine/valentina into develop

--HG--
branch : develop
This commit is contained in:
Felix Ulber 2015-02-26 18:45:37 +01:00
commit 1f0027fd22
28 changed files with 12870 additions and 4117 deletions

View file

@ -529,7 +529,6 @@ GCC_DEBUG_CXXFLAGS += \
-O0 \ -O0 \
-Wall \ -Wall \
-Wextra \ -Wextra \
-pedantic \
-fno-omit-frame-pointer # Need for exchndl.dll -fno-omit-frame-pointer # Need for exchndl.dll
CLANG_DEBUG_CXXFLAGS += \ CLANG_DEBUG_CXXFLAGS += \

View file

@ -37,4 +37,5 @@ TRANSLATIONS += translations/valentina.ts \
translations/valentina_fr_FR.ts \ translations/valentina_fr_FR.ts \
translations/valentina_it_IT.ts \ translations/valentina_it_IT.ts \
translations/valentina_nl_NL.ts \ translations/valentina_nl_NL.ts \
translations/valentina_id_ID.ts translations/valentina_id_ID.ts \
translations/valentina_es_ES.ts

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -181,7 +181,8 @@ INSTALL_TRANSLATIONS += \
$${TRANSLATIONS_PATH}/valentina_fr_FR.qm \ $${TRANSLATIONS_PATH}/valentina_fr_FR.qm \
$${TRANSLATIONS_PATH}/valentina_it_IT.qm \ $${TRANSLATIONS_PATH}/valentina_it_IT.qm \
$${TRANSLATIONS_PATH}/valentina_nl_NL.qm \ $${TRANSLATIONS_PATH}/valentina_nl_NL.qm \
$${TRANSLATIONS_PATH}/valentina_id_ID.qm $${TRANSLATIONS_PATH}/valentina_id_ID.qm \
$${TRANSLATIONS_PATH}/valentina_es_ES.qm
# Set "make install" command for Unix-like systems. # Set "make install" command for Unix-like systems.
unix{ unix{
@ -306,6 +307,14 @@ unix{
QMAKE_BUNDLE_DATA += TRANSLATION_id_ID QMAKE_BUNDLE_DATA += TRANSLATION_id_ID
} }
exists($${TRANSLATIONS_PATH}/valentina_es_ES.qm){
TRANSLATION_es_ES.files += \
$${TRANSLATIONS_PATH}/valentina_es_ES.qm \
$${TRANSLATIONS_PATH}/Localizable.strings
TRANSLATION_es_ES.path = "$$RESOURCES_DIR/translations/es_ES.lproj"
QMAKE_BUNDLE_DATA += TRANSLATION_es_ES
}
# Symlinks also good names for copying. Make will take origin file and copy them with using symlink name. # Symlinks also good names for copying. Make will take origin file and copy them with using symlink name.
# For bundle this names more then enough. We don't need care much about libraries versions. # For bundle this names more then enough. We don't need care much about libraries versions.
libraries.path = $$FRAMEWORKS_DIR libraries.path = $$FRAMEWORKS_DIR

View file

@ -10,7 +10,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>583</width> <width>583</width>
<height>480</height> <height>524</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -22,13 +22,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>573</width> <width>573</width>
<height>480</height> <height>524</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>583</width> <width>583</width>
<height>480</height> <height>524</height>
</size> </size>
</property> </property>
<property name="cursor"> <property name="cursor">

View file

@ -100,6 +100,30 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
{ {
ui->toolBoxMeasurements->setItemEnabled(0, false); ui->toolBoxMeasurements->setItemEnabled(0, false);
const QString filePath = doc->MPath();
VStandardMeasurements *mSt = nullptr;
try
{
VDomDocument::ValidateXML("://schema/standard_measurements.xsd", filePath);
mSt = new VStandardMeasurements(data);
mSt->setXMLContent(filePath);
ui->labelBaseValues->setText(tr("Base size: %1 %3; Base height: %2 %3").arg(mSt->Size())
.arg(mSt->Height()).arg(VDomDocument::UnitsToStr(qApp->patternUnit())));
ui->labelDescription->setText(tr("Description: \"%1\"").arg(mSt->TrDescription()));
delete mSt;
}
catch (VException &e)
{
e.CriticalMessageBox(tr("File error."), this);
if (mSt != nullptr)
{
delete mSt;
}
emit DialogClosed(QDialog::Rejected);
return;
}
} }
else else
{ {
@ -133,6 +157,10 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
connect(ui->comboBoxSex, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(ui->comboBoxSex, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&DialogIncrements::SaveSex); &DialogIncrements::SaveSex);
connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate); connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate);
// hide fileds that don't exist in individual measurements
ui->labelBaseValues->setVisible(false);
ui->labelDescription->setVisible(false);
} }
ui->toolBoxMeasurements->setCurrentIndex(1); ui->toolBoxMeasurements->setCurrentIndex(1);

View file

@ -118,8 +118,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>559</width> <width>939</width>
<height>82</height> <height>411</height>
</rect> </rect>
</property> </property>
<attribute name="icon"> <attribute name="icon">
@ -290,6 +290,23 @@
<string>Measurements</string> <string>Measurements</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="labelBaseValues">
<property name="text">
<string notr="true">Base size: ; base height: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelDescription">
<property name="text">
<string notr="true">Description:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkBoxHideEmpty"> <widget class="QCheckBox" name="checkBoxHideEmpty">
<property name="text"> <property name="text">

View file

@ -135,7 +135,7 @@
<item row="2" column="2"> <item row="2" column="2">
<widget class="QLabel" name="labelSizeDescription"> <widget class="QLabel" name="labelSizeDescription">
<property name="text"> <property name="text">
<string>TextLabel</string> <string notr="true">TextLabel</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -144,7 +144,7 @@
<item> <item>
<widget class="QToolButton" name="toolButtonPortrate"> <widget class="QToolButton" name="toolButtonPortrate">
<property name="text"> <property name="text">
<string>...</string> <string notr="true">...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../share/resources/icon.qrc"> <iconset resource="../../share/resources/icon.qrc">
@ -167,7 +167,7 @@
<item> <item>
<widget class="QToolButton" name="toolButtonLandscape"> <widget class="QToolButton" name="toolButtonLandscape">
<property name="text"> <property name="text">
<string>...</string> <string notr="true">...</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../../share/resources/icon.qrc"> <iconset resource="../../share/resources/icon.qrc">
@ -511,7 +511,7 @@
</connection> </connection>
</connections> </connections>
<buttongroups> <buttongroups>
<buttongroup name="buttonGroupPrinciple"/>
<buttongroup name="buttonGroup"/> <buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroupPrinciple"/>
</buttongroups> </buttongroups>
</ui> </ui>

View file

@ -183,16 +183,11 @@ void DialogStandardMeasurements::LoadStandardTables()
} }
else else
{ {
const QString trDesc = qApp->STDescription(m.Id()); const QString desc = m.TrDescription();
if (trDesc.isEmpty() == false) if (desc.isEmpty() == false)
{ {
qCDebug(vStMeasur)<<"Adding user table from"<<fi.absoluteFilePath(); qCDebug(vStMeasur)<<"Adding table from"<<fi.absoluteFilePath();
ui->comboBoxTables->addItem(trDesc, QVariant(fi.absoluteFilePath())); ui->comboBoxTables->addItem(desc, QVariant(fi.absoluteFilePath()));
}
else if (m.Description().isEmpty() == false)
{
qCDebug(vStMeasur)<<"Adding table with id"<<m.Id()<<"from"<<fi.absoluteFilePath();
ui->comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath()));
} }
} }
} }

View file

@ -340,11 +340,12 @@ void DialogDetail::ClickedReverse(bool checked)
*/ */
void DialogDetail::ObjectChanged(int row) void DialogDetail::ObjectChanged(int row)
{ {
if (ui.listWidget->count() == 0 || row == -1) if (ui.listWidget->count() == 0 || row == -1 || row >= ui.listWidget->count())
{ {
return; return;
} }
const QListWidgetItem *item = ui.listWidget->item( row ); const QListWidgetItem *item = ui.listWidget->item( row );
SCASSERT(item != nullptr);
const VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)); const VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx())); ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy())); ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));

View file

@ -861,12 +861,12 @@ void MainWindow::ToolBarOption()
const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes()); const QStringList listSizes = VMeasurement::ListSizes(doc->GetGradationSizes());
gradationHeights = SetGradationList(tr("Height: "), listHeights); gradationHeights = SetGradationList(tr("Height: "), listHeights);
SetDefaultHeight(static_cast<int>(GHeights::H176)); SetDefaultHeight(static_cast<int>(pattern->height()));
connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(gradationHeights, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &MainWindow::ChangedHeight); this, &MainWindow::ChangedHeight);
gradationSizes = SetGradationList(tr("Size: "), listSizes); gradationSizes = SetGradationList(tr("Size: "), listSizes);
SetDefaultSize(static_cast<int>(GSizes::S50)); SetDefaultSize(static_cast<int>(pattern->size()));
connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), connect(gradationSizes, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
this, &MainWindow::ChangedSize); this, &MainWindow::ChangedSize);
@ -890,12 +890,13 @@ QComboBox *MainWindow::SetGradationList(const QString &label, const QStringList
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetDefaultHeight set base height in combobox.
* @param value [in] height value in pattern units.
*/
void MainWindow::SetDefaultHeight(int value) void MainWindow::SetDefaultHeight(int value)
{ {
qreal val = VAbstractMeasurements::UnitConvertor(value, Unit::Cm, qApp->patternUnit()); const qint32 index = gradationHeights->findText(QString("%1").arg(value));
QString strVal = QString("%1").arg(val);
qint32 index = gradationHeights->findText(strVal);
if (index != -1) if (index != -1)
{ {
gradationHeights->setCurrentIndex(index); gradationHeights->setCurrentIndex(index);
@ -907,12 +908,13 @@ void MainWindow::SetDefaultHeight(int value)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetDefaultSize set base size in combobox.
* @param value [in] size value in pattern units.
*/
void MainWindow::SetDefaultSize(int value) void MainWindow::SetDefaultSize(int value)
{ {
qreal val = VAbstractMeasurements::UnitConvertor(value, Unit::Cm, qApp->patternUnit()); const qint32 index = gradationSizes->findText(QString("%1").arg(value));
QString strVal = QString("%1").arg(val);
qint32 index = gradationSizes->findText(strVal);
if (index != -1) if (index != -1)
{ {
gradationSizes->setCurrentIndex(index); gradationSizes->setCurrentIndex(index);

View file

@ -48,7 +48,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>105</width> <width>105</width>
<height>262</height> <height>272</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -335,7 +335,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>105</width> <width>105</width>
<height>56</height> <height>58</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -411,7 +411,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>105</width> <width>105</width>
<height>150</height> <height>156</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -565,7 +565,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>105</width> <width>105</width>
<height>100</height> <height>104</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -667,7 +667,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>105</width> <width>105</width>
<height>56</height> <height>58</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -763,7 +763,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1100</width> <width>1100</width>
<height>21</height> <height>25</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">

View file

@ -10,5 +10,6 @@
<file>flags/Russia.png</file> <file>flags/Russia.png</file>
<file>flags/Ukraine.png</file> <file>flags/Ukraine.png</file>
<file>flags/UnitedStates.png</file> <file>flags/UnitedStates.png</file>
<file>flags/Spain.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

View file

@ -119,6 +119,9 @@ VAbstractTool::~VAbstractTool()
*/ */
void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view) void VAbstractTool::NewSceneRect(QGraphicsScene *sc, QGraphicsView *view)
{ {
SCASSERT(sc != nullptr);
SCASSERT(view != nullptr);
QRectF rect = sc->itemsBoundingRect(); QRectF rect = sc->itemsBoundingRect();
QRect rec0 = view->rect(); QRect rec0 = view->rect();

View file

@ -34,8 +34,10 @@ const QString VStandardMeasurements::TagDescription = QStringLiteral("descr
const QString VStandardMeasurements::TagId = QStringLiteral("id"); const QString VStandardMeasurements::TagId = QStringLiteral("id");
const QString VStandardMeasurements::TagSize = QStringLiteral("size"); const QString VStandardMeasurements::TagSize = QStringLiteral("size");
const QString VStandardMeasurements::TagHeight = QStringLiteral("height"); const QString VStandardMeasurements::TagHeight = QStringLiteral("height");
const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase"); const QString VStandardMeasurements::AttrSize_increase = QStringLiteral("size_increase");
const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase"); const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase");
const QString VStandardMeasurements::AttrBase = QStringLiteral("base");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VStandardMeasurements::VStandardMeasurements(VContainer *data) VStandardMeasurements::VStandardMeasurements(VContainer *data)
@ -49,7 +51,7 @@ VStandardMeasurements::~VStandardMeasurements()
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VStandardMeasurements::Description() QString VStandardMeasurements::OrigDescription ()
{ {
const QString desc = UniqueTagText(TagDescription, ""); const QString desc = UniqueTagText(TagDescription, "");
if (desc.isEmpty()) if (desc.isEmpty())
@ -59,6 +61,20 @@ QString VStandardMeasurements::Description()
return desc; return desc;
} }
//---------------------------------------------------------------------------------------------------------------------
QString VStandardMeasurements::TrDescription()
{
const QString trDesc = qApp->STDescription(Id());
if (trDesc.isEmpty() == false)
{
return trDesc;
}
else
{
return OrigDescription ();
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString VStandardMeasurements::Id() QString VStandardMeasurements::Id()
{ {
@ -70,6 +86,18 @@ QString VStandardMeasurements::Id()
return id; return id;
} }
//---------------------------------------------------------------------------------------------------------------------
qreal VStandardMeasurements::Size() const
{
return TakeParametr(TagSize, AttrBase, 50);
}
//---------------------------------------------------------------------------------------------------------------------
qreal VStandardMeasurements::Height() const
{
return TakeParametr(TagHeight, AttrBase, 176);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag) void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const QString &tag)
{ {
@ -93,7 +121,7 @@ void VStandardMeasurements::ReadMeasurement(const QDomElement &domElement, const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) const qreal VStandardMeasurements::TakeParametr(const QString &tag, const QString &attr, qreal defValue) const
{ {
const qreal defVal = UnitConvertor(defValue, Unit::Cm, qApp->patternUnit()); const qreal defVal = UnitConvertor(defValue, Unit::Cm, qApp->patternUnit());
@ -110,7 +138,7 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) co
const QDomElement domElement = domNode.toElement(); const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false) if (domElement.isNull() == false)
{ {
qreal value = GetParametrDouble(domElement, AttrValue, QString("%1").arg(defVal)); qreal value = GetParametrDouble(domElement, attr, QString("%1").arg(defVal));
value = UnitConvertor(value, MUnit(), qApp->patternUnit()); value = UnitConvertor(value, MUnit(), qApp->patternUnit());
return value; return value;
} }
@ -122,15 +150,13 @@ qreal VStandardMeasurements::TakeParametr(const QString &tag, qreal defValue) co
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::SetSize() void VStandardMeasurements::SetSize()
{ {
const qreal value = TakeParametr(TagSize, 50); data->SetSize(Size());
data->SetSize(value);
data->SetSizeName(size_M); data->SetSizeName(size_M);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VStandardMeasurements::SetHeight() void VStandardMeasurements::SetHeight()
{ {
const qreal value = TakeParametr(TagHeight, 176); data->SetHeight(Height());
data->SetHeight(value);
data->SetHeightName(height_M); data->SetHeightName(height_M);
} }

View file

@ -44,8 +44,13 @@ class VStandardMeasurements:public VAbstractMeasurements
public: public:
VStandardMeasurements(VContainer *data); VStandardMeasurements(VContainer *data);
virtual ~VStandardMeasurements(); virtual ~VStandardMeasurements();
QString Description(); QString OrigDescription ();
QString TrDescription ();
QString Id(); QString Id();
qreal Size() const;
qreal Height() const;
void SetSize(); void SetSize();
void SetHeight(); void SetHeight();
static const QString TagMeasurement; static const QString TagMeasurement;
@ -53,13 +58,15 @@ public:
static const QString TagId; static const QString TagId;
static const QString TagSize; static const QString TagSize;
static const QString TagHeight; static const QString TagHeight;
static const QString AttrSize_increase; static const QString AttrSize_increase;
static const QString AttrHeight_increase; static const QString AttrHeight_increase;
static const QString AttrBase;
protected: protected:
virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag); virtual void ReadMeasurement(const QDomElement &domElement, const QString &tag);
private: private:
Q_DISABLE_COPY(VStandardMeasurements) Q_DISABLE_COPY(VStandardMeasurements)
qreal TakeParametr(const QString &tag, qreal defValue) const; qreal TakeParametr(const QString &tag, const QString &attr, qreal defValue) const;
}; };
#endif // VSTANDARDMEASUREMENTS_H #endif // VSTANDARDMEASUREMENTS_H

View file

@ -15,7 +15,6 @@
<xs:element name="height"> <xs:element name="height">
<xs:complexType> <xs:complexType>
<xs:attribute name="base" type="xs:double"></xs:attribute> <xs:attribute name="base" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="body-measurements"> <xs:element name="body-measurements">