Refactoring.

This commit is contained in:
Roman Telezhynskyi 2022-08-03 20:28:08 +03:00
parent 74da6b8e1e
commit a68793cc82
2 changed files with 95 additions and 93 deletions

View File

@ -28,7 +28,6 @@
#include "dialogincrements.h" #include "dialogincrements.h"
#include "ui_dialogincrements.h" #include "ui_dialogincrements.h"
#include "../vwidgets/vwidgetpopup.h"
#include "../vmisc/vvalentinasettings.h" #include "../vmisc/vvalentinasettings.h"
#include "../qmuparser/qmudef.h" #include "../qmuparser/qmudef.h"
#include "../qmuparser/qmutokenparser.h" #include "../qmuparser/qmutokenparser.h"
@ -84,9 +83,9 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
m_search = QSharedPointer<VTableSearch>(new VTableSearch(ui->tableWidgetIncrement)); m_search = QSharedPointer<VTableSearch>(new VTableSearch(ui->tableWidgetIncrement));
m_searchPC = QSharedPointer<VTableSearch>(new VTableSearch(ui->tableWidgetPC)); m_searchPC = QSharedPointer<VTableSearch>(new VTableSearch(ui->tableWidgetPC));
formulaBaseHeight = ui->plainTextEditFormula->height(); m_formulaBaseHeight = ui->plainTextEditFormula->height();
ui->plainTextEditFormula->installEventFilter(this); ui->plainTextEditFormula->installEventFilter(this);
formulaBaseHeightPC = ui->plainTextEditFormulaPC->height(); m_formulaBaseHeightPC = ui->plainTextEditFormulaPC->height();
ui->plainTextEditFormulaPC->installEventFilter(this); ui->plainTextEditFormulaPC->installEventFilter(this);
VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c()); VAbstractApplication::VApp()->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
@ -196,7 +195,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget
currentRow++; currentRow++;
table->setRowCount ( varTable.size() ); table->setRowCount ( varTable.size() );
QTableWidgetItem *item = new QTableWidgetItem(i.key()); auto *item = new QTableWidgetItem(i.key());
item->setTextAlignment(Qt::AlignLeft); item->setTextAlignment(Qt::AlignLeft);
QFont font = item->font(); QFont font = item->font();
font.setBold(true); font.setBold(true);
@ -283,12 +282,12 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QTableWidgetItem * DialogIncrements::AddCell(QTableWidget *table, const QString &text, int row, int column, auto DialogIncrements::AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment,
int aligment, bool ok) bool ok) -> QTableWidgetItem *
{ {
SCASSERT(table != nullptr) SCASSERT(table != nullptr)
QTableWidgetItem *item = new QTableWidgetItem(text); auto *item = new QTableWidgetItem(text);
item->setTextAlignment(aligment); item->setTextAlignment(aligment);
item->setToolTip(text); item->setToolTip(text);
@ -310,8 +309,8 @@ QTableWidgetItem * DialogIncrements::AddCell(QTableWidget *table, const QString
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QTableWidgetItem* DialogIncrements::AddSeparatorCell(QTableWidget *table, const QString &text, int row, int column, auto DialogIncrements::AddSeparatorCell(QTableWidget *table, const QString &text, int row, int column, int aligment,
int aligment, bool ok) bool ok) -> QTableWidgetItem*
{ {
QTableWidgetItem *item = AddCell(table, text, row, column, aligment, ok); QTableWidgetItem *item = AddCell(table, text, row, column, aligment, ok);
@ -323,21 +322,21 @@ QTableWidgetItem* DialogIncrements::AddSeparatorCell(QTableWidget *table, const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString DialogIncrements::GetCustomName() const auto DialogIncrements::GetCustomName() const -> QString
{ {
qint32 num = 1; qint32 num = 1;
QString name; QString name;
do do
{ {
name = CustomIncrSign + VAbstractApplication::VApp()->TrVars()->InternalVarToUser(increment_) + name = CustomIncrSign + VAbstractApplication::VApp()->TrVars()->InternalVarToUser(increment_) +
QString().number(num); QString::number(num);
num++; num++;
} while (not data->IsUnique(name)); } while (not data->IsUnique(name));
return name; return name;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString DialogIncrements::ClearIncrementName(const QString &name) const auto DialogIncrements::ClearIncrementName(const QString &name) -> QString
{ {
QString clear = name; QString clear = name;
const int index = clear.indexOf(CustomIncrSign); const int index = clear.indexOf(CustomIncrSign);
@ -641,11 +640,11 @@ void DialogIncrements::LocalUpdateTree()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogIncrements::IncrementUsed(const QString &name) const auto DialogIncrements::IncrementUsed(const QString &name) const -> bool
{ {
const QVector<VFormulaField> expressions = doc->ListExpressions(); const QVector<VFormulaField> expressions = doc->ListExpressions();
for(auto &field : expressions) for(const auto &field : expressions)
{ {
if (field.expression.indexOf(name) != -1) if (field.expression.indexOf(name) != -1)
{ {
@ -672,16 +671,16 @@ bool DialogIncrements::IncrementUsed(const QString &name) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::CacheRename(const QString &name, const QString &newName) void DialogIncrements::CacheRename(const QString &name, const QString &newName)
{ {
for (int i = 0; i < renameList.size(); ++i) for (auto & i : m_renameList)
{ {
if (renameList.at(i).second == name) if (i.second == name)
{ {
renameList[i].second = newName; i.second = newName;
return; return;
} }
} }
renameList.append(qMakePair(name, newName)); m_renameList.append(qMakePair(name, newName));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -763,7 +762,7 @@ void DialogIncrements::ShowTableIncrementDetails(QTableWidget *table)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMenu *DialogIncrements::InitVarTypeMenu(QMenu *menu, bool incrementTab) auto DialogIncrements::InitVarTypeMenu(QMenu *menu, bool incrementTab) -> QMenu *
{ {
if (menu == nullptr) if (menu == nullptr)
{ {
@ -823,7 +822,7 @@ void DialogIncrements::AddNewIncrement(IncrementType type)
doc->AddEmptyPreviewCalculationAfter(nameField->text(), name, type); doc->AddEmptyPreviewCalculationAfter(nameField->text(), name, type);
} }
hasChanges = true; m_hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
table->selectRow(currentRow); table->selectRow(currentRow);
@ -870,28 +869,30 @@ void DialogIncrements::InitSearch()
SaveIncrementsSearchRequest(); SaveIncrementsSearchRequest();
InitPreviewCalculationsSearchHistory(); InitPreviewCalculationsSearchHistory();
m_search->FindPrevious(); m_search->FindPrevious();
ui->labelResults->setText(QString("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount())); ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
}); });
connect(ui->toolButtonFindPreviousPC, &QToolButton::clicked, this, [this]() connect(ui->toolButtonFindPreviousPC, &QToolButton::clicked, this, [this]()
{ {
SavePreviewCalculationsSearchRequest(); SavePreviewCalculationsSearchRequest();
InitPreviewCalculationsSearchHistory(); InitPreviewCalculationsSearchHistory();
m_searchPC->FindPrevious(); m_searchPC->FindPrevious();
ui->labelResultsPC->setText(QString("%1/%2").arg(m_searchPC->MatchIndex()+1).arg(m_searchPC->MatchCount())); ui->labelResultsPC->setText(
QStringLiteral("%1/%2").arg(m_searchPC->MatchIndex()+1).arg(m_searchPC->MatchCount()));
}); });
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this]() connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this]()
{ {
SaveIncrementsSearchRequest(); SaveIncrementsSearchRequest();
InitIncrementsSearchHistory(); InitIncrementsSearchHistory();
m_search->FindNext(); m_search->FindNext();
ui->labelResults->setText(QString("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount())); ui->labelResults->setText(QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
}); });
connect(ui->toolButtonFindNextPC, &QToolButton::clicked, this, [this]() connect(ui->toolButtonFindNextPC, &QToolButton::clicked, this, [this]()
{ {
SavePreviewCalculationsSearchRequest(); SavePreviewCalculationsSearchRequest();
InitPreviewCalculationsSearchHistory(); InitPreviewCalculationsSearchHistory();
m_searchPC->FindNext(); m_searchPC->FindNext();
ui->labelResultsPC->setText(QString("%1/%2").arg(m_searchPC->MatchIndex()+1).arg(m_searchPC->MatchCount())); ui->labelResultsPC->setText(
QStringLiteral("%1/%2").arg(m_searchPC->MatchIndex()+1).arg(m_searchPC->MatchCount()));
}); });
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state) connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
@ -901,7 +902,8 @@ void DialogIncrements::InitSearch()
if (state) if (state)
{ {
ui->labelResults->setText(QString("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount())); ui->labelResults->setText(
QStringLiteral("%1/%2").arg(m_search->MatchIndex()+1).arg(m_search->MatchCount()));
} }
else else
{ {
@ -933,7 +935,8 @@ void DialogIncrements::InitSearch()
if (state) if (state)
{ {
ui->labelResultsPC->setText(QString("%1/%2").arg(m_searchPC->MatchIndex()+1).arg(m_searchPC->MatchCount())); ui->labelResultsPC->setText(
QStringLiteral("%1/%2").arg(m_searchPC->MatchIndex()+1).arg(m_searchPC->MatchCount()));
} }
else else
{ {
@ -1220,7 +1223,7 @@ void DialogIncrements::InitIncrementUnits(QComboBox *combo)
*/ */
void DialogIncrements::FullUpdateFromFile() void DialogIncrements::FullUpdateFromFile()
{ {
hasChanges = false; m_hasChanges = false;
const int incrementRow = ui->tableWidgetIncrement->currentRow(); const int incrementRow = ui->tableWidgetIncrement->currentRow();
const int pcRow = ui->tableWidgetPC->currentRow(); const int pcRow = ui->tableWidgetPC->currentRow();
@ -1252,14 +1255,14 @@ void DialogIncrements::FullUpdateFromFile()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::RefreshPattern() void DialogIncrements::RefreshPattern()
{ {
if (hasChanges) if (m_hasChanges)
{ {
QVector<VFormulaField> expressions = doc->ListExpressions(); QVector<VFormulaField> expressions = doc->ListExpressions();
for (auto &item : renameList) for (auto &item : m_renameList)
{ {
doc->ReplaceNameInFormula(expressions, item.first, item.second); doc->ReplaceNameInFormula(expressions, item.first, item.second);
} }
renameList.clear(); m_renameList.clear();
const int row = ui->tableWidgetIncrement->currentRow(); const int row = ui->tableWidgetIncrement->currentRow();
const int rowPC = ui->tableWidgetPC->currentRow(); const int rowPC = ui->tableWidgetPC->currentRow();
@ -1274,7 +1277,7 @@ void DialogIncrements::RefreshPattern()
ui->tableWidgetPC->selectRow(rowPC); ui->tableWidgetPC->selectRow(rowPC);
ui->tableWidgetPC->blockSignals(false); ui->tableWidgetPC->blockSignals(false);
hasChanges = false; m_hasChanges = false;
} }
} }
@ -1399,7 +1402,7 @@ void DialogIncrements::RemoveIncrement()
doc->RemovePreviewCalculation(nameField->text()); doc->RemovePreviewCalculation(nameField->text());
} }
hasChanges = true; m_hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
table->rowCount() > 0 ? table->selectRow(0) : EnableDetails(table, false); table->rowCount() > 0 ? table->selectRow(0) : EnableDetails(table, false);
@ -1444,7 +1447,7 @@ void DialogIncrements::MoveUp()
doc->MoveUpPreviewCalculation(nameField->text()); doc->MoveUpPreviewCalculation(nameField->text());
} }
hasChanges = true; m_hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
table->selectRow(row-1); table->selectRow(row-1);
@ -1454,7 +1457,7 @@ void DialogIncrements::MoveUp()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::MoveDown() void DialogIncrements::MoveDown()
{ {
QToolButton *button = qobject_cast<QToolButton *>(sender()); auto *button = qobject_cast<QToolButton *>(sender());
QTableWidget *table = nullptr; QTableWidget *table = nullptr;
@ -1489,7 +1492,7 @@ void DialogIncrements::MoveDown()
doc->MoveDownPreviewCalculation(nameField->text()); doc->MoveDownPreviewCalculation(nameField->text());
} }
hasChanges = true; m_hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
table->selectRow(row+1); table->selectRow(row+1);
@ -1499,7 +1502,7 @@ void DialogIncrements::MoveDown()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveIncrName(const QString &text) void DialogIncrements::SaveIncrName(const QString &text)
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender()); auto *lineEdit = qobject_cast<QLineEdit *>(sender());
QTableWidget *table = nullptr; QTableWidget *table = nullptr;
@ -1535,7 +1538,7 @@ void DialogIncrements::SaveIncrName(const QString &text)
QString name = newName; QString name = newName;
do do
{ {
name = name + '_' + QString().number(num); name = name + '_' + QString::number(num);
num++; num++;
} while (not data->IsUnique(name)); } while (not data->IsUnique(name));
newName = name; newName = name;
@ -1547,7 +1550,7 @@ void DialogIncrements::SaveIncrName(const QString &text)
CacheRename(nameField->text(), newName); CacheRename(nameField->text(), newName);
hasChanges = true; m_hasChanges = true;
if (updateFlag) if (updateFlag)
{ {
LocalUpdateTree(); LocalUpdateTree();
@ -1645,7 +1648,7 @@ void DialogIncrements::SaveIncrDescription()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::SaveIncrFormula() void DialogIncrements::SaveIncrFormula()
{ {
QPlainTextEdit *textEdit = qobject_cast<QPlainTextEdit *>(sender()); auto *textEdit = qobject_cast<QPlainTextEdit *>(sender());
QTableWidget *table = nullptr; QTableWidget *table = nullptr;
QLabel *labelCalculatedValue = nullptr; QLabel *labelCalculatedValue = nullptr;
@ -1733,7 +1736,7 @@ void DialogIncrements::SaveIncrFormula()
const QTextCursor cursor = textEdit->textCursor(); const QTextCursor cursor = textEdit->textCursor();
hasChanges = true; m_hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
table->blockSignals(true); table->blockSignals(true);
@ -1750,7 +1753,7 @@ void DialogIncrements::DeployFormula()
SCASSERT(ui->plainTextEditFormulaPC != nullptr) SCASSERT(ui->plainTextEditFormulaPC != nullptr)
SCASSERT(ui->pushButtonGrowPC != nullptr) SCASSERT(ui->pushButtonGrowPC != nullptr)
QPushButton *button = qobject_cast<QPushButton *>(sender()); auto *button = qobject_cast<QPushButton *>(sender());
QPlainTextEdit *plainTextEditFormula = nullptr; QPlainTextEdit *plainTextEditFormula = nullptr;
QPushButton *pushButtonGrow = nullptr; QPushButton *pushButtonGrow = nullptr;
@ -1760,13 +1763,13 @@ void DialogIncrements::DeployFormula()
{ {
plainTextEditFormula = ui->plainTextEditFormula; plainTextEditFormula = ui->plainTextEditFormula;
pushButtonGrow = ui->pushButtonGrow; pushButtonGrow = ui->pushButtonGrow;
baseHeight = formulaBaseHeight; baseHeight = m_formulaBaseHeight;
} }
else if (button == ui->pushButtonGrowPC) else if (button == ui->pushButtonGrowPC)
{ {
plainTextEditFormula = ui->plainTextEditFormulaPC; plainTextEditFormula = ui->plainTextEditFormulaPC;
pushButtonGrow = ui->pushButtonGrowPC; pushButtonGrow = ui->pushButtonGrowPC;
baseHeight = formulaBaseHeightPC; baseHeight = m_formulaBaseHeightPC;
} }
else else
{ {
@ -1803,7 +1806,7 @@ void DialogIncrements::DeployFormula()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::Fx() void DialogIncrements::Fx()
{ {
QToolButton *button = qobject_cast<QToolButton *>(sender()); auto *button = qobject_cast<QToolButton *>(sender());
QTableWidget *table = nullptr; QTableWidget *table = nullptr;
QPlainTextEdit *plainTextEditFormula = nullptr; QPlainTextEdit *plainTextEditFormula = nullptr;
@ -1840,9 +1843,8 @@ void DialogIncrements::Fx()
dialog->setWindowTitle(tr("Edit increment")); dialog->setWindowTitle(tr("Edit increment"));
incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode(); incrementMode ? dialog->SetIncrementsMode() : dialog->SetPreviewCalculationsMode();
dialog->SetFormula(VAbstractApplication::VApp()->TrVars() dialog->SetFormula(VTranslateVars::TryFormulaFromUser(plainTextEditFormula->toPlainText(),
->TryFormulaFromUser(plainTextEditFormula->toPlainText(), VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
VAbstractApplication::VApp()->Settings()->GetOsSeparator()));
const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true); const QString postfix = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true);
dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch) dialog->setPostfix(postfix);//Show unit in dialog lable (cm, mm or inch)
@ -1852,7 +1854,7 @@ void DialogIncrements::Fx()
// Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer. // Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer.
doc->SetIncrementFormula(table->item(row, 0)->text(), dialog->GetFormula()); doc->SetIncrementFormula(table->item(row, 0)->text(), dialog->GetFormula());
hasChanges = true; m_hasChanges = true;
LocalUpdateTree(); LocalUpdateTree();
table->selectRow(row); table->selectRow(row);
@ -1910,13 +1912,13 @@ void DialogIncrements::changeEvent(QEvent *event)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogIncrements::eventFilter(QObject *object, QEvent *event) auto DialogIncrements::eventFilter(QObject *object, QEvent *event) -> bool
{ {
if (QLineEdit *textEdit = qobject_cast<QLineEdit *>(object)) if (auto *textEdit = qobject_cast<QLineEdit *>(object))
{ {
if (event->type() == QEvent::KeyPress) if (event->type() == QEvent::KeyPress)
{ {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); auto *keyEvent = static_cast<QKeyEvent *>(event);
if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier)) if ((keyEvent->key() == Qt::Key_Period) && (keyEvent->modifiers() & Qt::KeypadModifier))
{ {
if (VAbstractApplication::VApp()->Settings()->GetOsSeparator()) if (VAbstractApplication::VApp()->Settings()->GetOsSeparator())

View File

@ -47,10 +47,10 @@ namespace Ui
*/ */
class DialogIncrements : public DialogTool class DialogIncrements : public DialogTool
{ {
Q_OBJECT Q_OBJECT // NOLINT
public: public:
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr); DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
virtual ~DialogIncrements() override; ~DialogIncrements() override;
void RestoreAfterClose(); void RestoreAfterClose();
@ -61,12 +61,12 @@ public slots:
void FullUpdateFromFile(); void FullUpdateFromFile();
protected: protected:
virtual void closeEvent ( QCloseEvent * event ) override; void closeEvent ( QCloseEvent * event ) override;
virtual void changeEvent ( QEvent * event) override; void changeEvent ( QEvent * event) override;
virtual bool eventFilter(QObject *object, QEvent *event) override; auto eventFilter(QObject *object, QEvent *event) -> bool override;
virtual void showEvent( QShowEvent *event ) override; void showEvent( QShowEvent *event ) override;
virtual void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
virtual bool IsValid() const final {return true;} auto IsValid() const -> bool final {return true;}
private slots: private slots:
void ShowIncrementDetails(); void ShowIncrementDetails();
void AddIncrement(); void AddIncrement();
@ -83,73 +83,73 @@ private slots:
void RefreshPattern(); void RefreshPattern();
private: private:
Q_DISABLE_COPY(DialogIncrements) Q_DISABLE_COPY_MOVE(DialogIncrements) // NOLINT
/** @brief ui keeps information about user interface */ /** @brief ui keeps information about user interface */
Ui::DialogIncrements *ui; Ui::DialogIncrements *ui;
/** @brief data container with data */ /** @brief data container with data */
VContainer *data; // need because we must change data //-V703 VContainer *data; // need because we must change data //-V703
/** @brief doc dom document container */ /** @brief doc dom document container */
VPattern *doc; VPattern *doc;
/** @brief m_completeData need to show all internal variables */ /** @brief m_completeData need to show all internal variables */
VContainer m_completeData; VContainer m_completeData;
int formulaBaseHeight{0}; int m_formulaBaseHeight{0};
int formulaBaseHeightPC{0}; int m_formulaBaseHeightPC{0};
QSharedPointer<VTableSearch> m_search{}; QSharedPointer<VTableSearch> m_search{};
QSharedPointer<VTableSearch> m_searchPC{}; QSharedPointer<VTableSearch> m_searchPC{};
bool hasChanges{false}; bool m_hasChanges{false};
QVector<QPair<QString, QString>> renameList{}; QVector<QPair<QString, QString>> m_renameList{};
QMenu *m_searchHistory; QMenu *m_searchHistory;
QMenu *m_searchHistoryPC; QMenu *m_searchHistoryPC;
template <typename T> template <typename T>
void FillTable(const QMap<QString, T> &varTable, QTableWidget *table); void FillTable(const QMap<QString, T> &varTable, QTableWidget *table);
void FillIncrementsTable(QTableWidget *table, static void FillIncrementsTable(QTableWidget *table, const QMap<QString, QSharedPointer<VIncrement> > &increments,
const QMap<QString, QSharedPointer<VIncrement> > &increments, bool takePreviewCalculations);
bool takePreviewCalculations);
void FillIncrements(); void FillIncrements();
void FillPreviewCalculations(); void FillPreviewCalculations();
void FillLengthsLines(); void FillLengthsLines();
void FillLengthLinesAngles(); void FillLengthLinesAngles();
void FillLengthsCurves(); void FillLengthsCurves();
void FillCurvesCLengths(); void FillCurvesCLengths();
void FillRadiusesArcs(); void FillRadiusesArcs();
void FillAnglesCurves(); void FillAnglesCurves();
void ShowUnits(); void ShowUnits();
void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit); static void ShowHeaderUnits(QTableWidget *table, int column, const QString &unit);
QTableWidgetItem* AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment, static auto AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment,
bool ok = true); bool ok = true) -> QTableWidgetItem*;
QTableWidgetItem* AddSeparatorCell(QTableWidget *table, const QString &text, int row, int column, int aligment, static auto AddSeparatorCell(QTableWidget *table, const QString &text, int row, int column, int aligment,
bool ok = true); bool ok = true) -> QTableWidgetItem*;
QString GetCustomName() const; auto GetCustomName() const -> QString;
QString ClearIncrementName(const QString &name) const; static auto ClearIncrementName(const QString &name) -> QString;
bool EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label, bool special); static auto EvalIncrementFormula(const QString &formula, bool fromUser, VContainer *data, QLabel *label,
void Controls(QTableWidget *table); bool special) -> bool;
void EnableDetails(QTableWidget *table, bool enabled); void Controls(QTableWidget *table);
void EnableDetails(QTableWidget *table, bool enabled);
void LocalUpdateTree(); void LocalUpdateTree();
bool IncrementUsed(const QString &name) const; auto IncrementUsed(const QString &name) const -> bool;
void CacheRename(const QString &name, const QString &newName); void CacheRename(const QString &name, const QString &newName);
void ShowTableIncrementDetails(QTableWidget *table); void ShowTableIncrementDetails(QTableWidget *table);
QMenu *InitVarTypeMenu(QMenu *menu, bool incrementTab); auto InitVarTypeMenu(QMenu *menu, bool incrementTab) -> QMenu *;
void AddNewIncrement(IncrementType type); void AddNewIncrement(IncrementType type);
@ -159,7 +159,7 @@ private:
void SaveIncrementsSearchRequest(); void SaveIncrementsSearchRequest();
void SavePreviewCalculationsSearchRequest(); void SavePreviewCalculationsSearchRequest();
void UpdateSearchControlsTooltips(); void UpdateSearchControlsTooltips();
void InitIncrementUnits(QComboBox *combo); static void InitIncrementUnits(QComboBox *combo);
}; };
#endif // DIALOGINCREMENTS_H #endif // DIALOGINCREMENTS_H