Merged in ValentinaZhuravska/valentina/feature (pull request #140)

Resolved Issue #424. Improve Formula Wizard dialog.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-08-17 23:22:59 +03:00
commit 00e36db0c5
6 changed files with 68 additions and 1 deletions

View File

@ -36,6 +36,7 @@
- [#496] Selector for selecting which pieces to print.
- [#520] Improve Union tool. An option to select about original pieces.
- [#262] Automatic Update notification.
- [#424] Improve Formula Wizard dialog.
# Version 0.4.5
- [#435] Valentina doesn't change the cursor.

View File

@ -403,7 +403,7 @@ void VTranslateVars::InitFunctions()
functions.insert(cosh_F, translate("VTranslateVars", "cosh", "hyperbolic cosine"));
functions.insert(tanh_F, translate("VTranslateVars", "tanh", "hyperbolic tangens function"));
functions.insert(asinh_F, translate("VTranslateVars", "asinh", "hyperbolic arcus sine function"));
functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus tangens function"));
functions.insert(acosh_F, translate("VTranslateVars", "acosh", "hyperbolic arcus cosine function"));
functions.insert(atanh_F, translate("VTranslateVars", "atanh", "hyperbolic arcur tangens function"));
functions.insert(log2_F, translate("VTranslateVars", "log2", "logarithm to the base 2"));
functions.insert(log10_F, translate("VTranslateVars", "log10", "logarithm to the base 10"));
@ -946,3 +946,9 @@ void VTranslateVars::Retranslate()
InitFunctions();
InitPostfixOperators();
}
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QmuTranslation> VTranslateVars::GetFunctions() const
{
return functions;
}

View File

@ -61,6 +61,7 @@ public:
QString FormulaToUser(const QString &formula, bool osSeparator) const;
virtual void Retranslate() Q_DECL_OVERRIDE;
QMap<QString, qmu::QmuTranslation> GetFunctions() const;
private:
Q_DISABLE_COPY(VTranslateVars)

View File

@ -217,6 +217,11 @@ void DialogEditWrongFormula::ValChanged(int row)
degreeSymbol, tr("Curve angle"));
return;
}
if (ui->radioButtonFunctions->isChecked())
{
ui->labelDescription->setText(item->toolTip());
return;
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -309,6 +314,16 @@ void DialogEditWrongFormula::Increments()
ShowVariable(data->DataIncrements());
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Functions show in list functions
*/
void DialogEditWrongFormula::Functions()
{
ui->checkBoxHideEmpty->setEnabled(false);
ShowFunctions();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::CheckState()
{
@ -384,6 +399,7 @@ void DialogEditWrongFormula::InitVariables()
connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements);
connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs);
connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves);
connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, &DialogEditWrongFormula::Functions);
}
//---------------------------------------------------------------------------------------------------------------------
@ -477,3 +493,31 @@ void DialogEditWrongFormula::ShowMeasurements(const QMap<QString, QSharedPointer
ui->tableWidget->selectRow(0);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ShowFunctions show functions in list
*/
void DialogEditWrongFormula::ShowFunctions()
{
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(0);
ui->tableWidget->setColumnHidden(ColumnFullName, true);
ui->labelDescription->setText("");
QMap<QString, qmu::QmuTranslation>::const_iterator i = qApp->TrVars()->GetFunctions().constBegin();
while (i != qApp->TrVars()->GetFunctions().constEnd())
{
ui->tableWidget->setRowCount(ui->tableWidget->rowCount() + 1);
QTableWidgetItem *item = new QTableWidgetItem(i.value().translate());
item->setFont(QFont("Times", 12, QFont::Bold));
ui->tableWidget->setItem(ui->tableWidget->rowCount()-1, ColumnName, item);
item->setToolTip(i.value().getMdisambiguation());
++i;
}
ui->tableWidget->blockSignals(false);
ui->tableWidget->selectRow(0);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
}

View File

@ -90,6 +90,7 @@ public slots:
void LengthCurves();
void AngleLines();
void Increments();
void Functions();
protected:
virtual void CheckState() Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
@ -113,6 +114,7 @@ private:
template <class key, class val>
void ShowVariable(const QMap<key, val> &var);
void ShowMeasurements(const QMap<QString, QSharedPointer<VMeasurement> > &var);
void ShowFunctions();
void SetDescription(const QString &name, qreal value, const QString &unit, const QString &description);
};

View File

@ -329,6 +329,19 @@
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButtonFunctions">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Functions</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>