New field full name.
--HG-- branch : feature
This commit is contained in:
parent
7484d9e807
commit
5697d45b2d
|
@ -418,6 +418,10 @@ void TMainWindow::Remove()
|
|||
ui->plainTextEditDescription->setPlainText("");
|
||||
ui->plainTextEditDescription->blockSignals(false);
|
||||
|
||||
ui->lineEditFullName->blockSignals(true);
|
||||
ui->lineEditFullName->setText("");
|
||||
ui->lineEditFullName->blockSignals(false);
|
||||
|
||||
if (mType == MeasurementsType::Standard)
|
||||
{
|
||||
ui->labelCalculatedValue->blockSignals(true);
|
||||
|
@ -664,6 +668,10 @@ void TMainWindow::ShowMData()
|
|||
}
|
||||
ui->plainTextEditDescription->blockSignals(false);
|
||||
|
||||
ui->lineEditFullName->blockSignals(true);
|
||||
ui->lineEditFullName->setText(meash->GetGuiText());
|
||||
ui->lineEditFullName->blockSignals(false);
|
||||
|
||||
if (mType == MeasurementsType::Standard)
|
||||
{
|
||||
ui->labelCalculatedValue->blockSignals(true);
|
||||
|
@ -936,6 +944,29 @@ void TMainWindow::SaveMDescription()
|
|||
ui->plainTextEditDescription->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::SaveMFullName()
|
||||
{
|
||||
const int row = ui->tableWidget->currentRow();
|
||||
|
||||
if (row == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), 0);
|
||||
m->SetMFullName(nameField->text(), ui->lineEditFullName->text());
|
||||
|
||||
MeasurementsWasSaved(false);
|
||||
|
||||
RefreshData();
|
||||
|
||||
ui->tableWidget->blockSignals(true);
|
||||
ui->tableWidget->selectRow(row);
|
||||
ui->tableWidget->blockSignals(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void TMainWindow::SetupMenu()
|
||||
{
|
||||
|
@ -1097,6 +1128,7 @@ void TMainWindow::InitWindow()
|
|||
|
||||
connect(ui->lineEditName, &QLineEdit::editingFinished, this, &TMainWindow::SaveMName);
|
||||
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
|
||||
connect(ui->lineEditFullName, &QLineEdit::editingFinished, this, &TMainWindow::SaveMFullName);
|
||||
|
||||
InitTable();
|
||||
}
|
||||
|
@ -1391,6 +1423,7 @@ void TMainWindow::MFields(bool enabled)
|
|||
{
|
||||
ui->lineEditName->setEnabled(enabled);
|
||||
ui->plainTextEditDescription->setEnabled(enabled);
|
||||
ui->lineEditFullName->setEnabled(enabled);
|
||||
|
||||
if (mType == MeasurementsType::Standard)
|
||||
{
|
||||
|
|
|
@ -94,6 +94,7 @@ private slots:
|
|||
void SaveMSizeIncrease(double value);
|
||||
void SaveMHeightIncrease(double value);
|
||||
void SaveMDescription();
|
||||
void SaveMFullName();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(TMainWindow)
|
||||
|
|
|
@ -233,14 +233,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QPlainTextEdit" name="plainTextEditDescription">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
|
@ -365,6 +365,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelFullName">
|
||||
<property name="text">
|
||||
<string>Full name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="lineEditFullName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -54,6 +54,7 @@ const QString VMeasurements::AttrSizeIncrease = QStringLiteral("size_increase"
|
|||
const QString VMeasurements::AttrHeightIncrease = QStringLiteral("height_increase");
|
||||
const QString VMeasurements::AttrDescription = QStringLiteral("description");
|
||||
const QString VMeasurements::AttrName = QStringLiteral("name");
|
||||
const QString VMeasurements::AttrFullName = QStringLiteral("full_name");
|
||||
|
||||
const QString VMeasurements::SexMale = QStringLiteral("male");
|
||||
const QString VMeasurements::SexFemale = QStringLiteral("female");
|
||||
|
@ -179,6 +180,16 @@ void VMeasurements::ReadMeasurements() const
|
|||
Q_UNUSED(e)
|
||||
}
|
||||
|
||||
QString fullName;
|
||||
try
|
||||
{
|
||||
fullName = GetParametrString(dom, AttrFullName);
|
||||
}
|
||||
catch (VExceptionEmptyParameter &e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
}
|
||||
|
||||
VMeasurement *meash;
|
||||
if (type == MeasurementsType::Standard)
|
||||
{
|
||||
|
@ -186,14 +197,14 @@ void VMeasurements::ReadMeasurements() const
|
|||
const qreal ksize = GetParametrDouble(dom, AttrSizeIncrease, "0");
|
||||
const qreal kheight = GetParametrDouble(dom, AttrHeightIncrease, "0");
|
||||
|
||||
meash = new VMeasurement(i, name, BaseSize(), BaseHeight(), base, ksize, kheight, "", description);
|
||||
meash = new VMeasurement(i, name, BaseSize(), BaseHeight(), base, ksize, kheight, fullName, description);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString formula = GetParametrString(dom, AttrValue, "0");
|
||||
bool ok = false;
|
||||
const qreal value = EvalFormula(data, formula, &ok);
|
||||
meash = new VMeasurement(data, i, name, value, formula, ok, "", description);
|
||||
meash = new VMeasurement(data, i, name, value, formula, ok, fullName, description);
|
||||
}
|
||||
data->AddVariable(name, meash);
|
||||
}
|
||||
|
@ -415,6 +426,16 @@ void VMeasurements::SetMDescription(const QString &name, const QString &text)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VMeasurements::SetMFullName(const QString &name, const QString &text)
|
||||
{
|
||||
QDomElement node = FindM(name);
|
||||
if (not node.isNull())
|
||||
{
|
||||
SetAttribute(node, AttrFullName, text);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VMeasurements::GenderToStr(const SexType &sex)
|
||||
{
|
||||
|
@ -566,6 +587,7 @@ QDomElement VMeasurements::MakeEmpty(const QString &name)
|
|||
{
|
||||
SetAttribute(element, AttrValue, QString("0"));
|
||||
SetAttribute(element, AttrDescription, QString(""));
|
||||
SetAttribute(element, AttrFullName, QString(""));
|
||||
}
|
||||
|
||||
return element;
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
void SetMSizeIncrease(const QString &name, double value);
|
||||
void SetMHeightIncrease(const QString &name, double value);
|
||||
void SetMDescription(const QString &name, const QString &text);
|
||||
void SetMFullName(const QString &name, const QString &text);
|
||||
|
||||
static const QString TagVST;
|
||||
static const QString TagVIT;
|
||||
|
@ -106,6 +107,7 @@ public:
|
|||
static const QString AttrHeightIncrease;
|
||||
static const QString AttrDescription;
|
||||
static const QString AttrName;
|
||||
static const QString AttrFullName;
|
||||
|
||||
static const QString SexMale;
|
||||
static const QString SexFemale;
|
||||
|
|
Loading…
Reference in New Issue
Block a user