Revamp some code

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5642 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2018-12-09 14:48:56 +00:00
parent e595e16d47
commit d0f3825bfc

View File

@@ -57,62 +57,13 @@ void SearchAndReplaceWorker::replaceDiagram(QList<Diagram *> diagram_list)
TitleBlockProperties old_propertie = d->border_and_titleblock.exportTitleBlock(); TitleBlockProperties old_propertie = d->border_and_titleblock.exportTitleBlock();
TitleBlockProperties new_properties = old_propertie; TitleBlockProperties new_properties = old_propertie;
if (!m_titleblock_properties.title.isEmpty()) new_properties.title = applyChange(new_properties.title, m_titleblock_properties.title);
{ new_properties.author = applyChange(new_properties.author, m_titleblock_properties.author);
if (m_titleblock_properties.title == eraseText()) { new_properties.filename = applyChange(new_properties.filename, m_titleblock_properties.filename);
new_properties.title.clear(); new_properties.plant = applyChange(new_properties.plant, m_titleblock_properties.plant);
} else { new_properties.locmach = applyChange(new_properties.locmach, m_titleblock_properties.locmach);
new_properties.title = m_titleblock_properties.title; new_properties.indexrev = applyChange(new_properties.indexrev, m_titleblock_properties.indexrev);
} new_properties.folio = applyChange(new_properties.folio, m_titleblock_properties.folio);
}
if (!m_titleblock_properties.author.isEmpty())
{
if (m_titleblock_properties.author == eraseText()) {
new_properties.author.clear();
} else {
new_properties.author = m_titleblock_properties.author;
}
}
if (!m_titleblock_properties.filename.isEmpty())
{
if (m_titleblock_properties.filename == eraseText()) {
new_properties.filename.clear();
} else {
new_properties.filename = m_titleblock_properties.filename;
}
}
if (!m_titleblock_properties.plant.isEmpty())
{
if (m_titleblock_properties.plant == eraseText()) {
new_properties.plant.clear();
} else {
new_properties.plant = m_titleblock_properties.plant;
}
}
if (!m_titleblock_properties.locmach.isEmpty())
{
if (m_titleblock_properties.locmach == eraseText()) {
new_properties.locmach.clear();
} else {
new_properties.locmach = m_titleblock_properties.locmach;
}
}
if (!m_titleblock_properties.indexrev.isEmpty())
{
if (m_titleblock_properties.indexrev == eraseText()) {
new_properties.indexrev.clear();
} else {
new_properties.indexrev = m_titleblock_properties.indexrev;
}
}
if (!m_titleblock_properties.folio.isEmpty())
{
if (m_titleblock_properties.folio == eraseText()) {
new_properties.folio.clear();
} else {
new_properties.folio = m_titleblock_properties.folio;
}
}
if (m_titleblock_properties.date.isValid()) if (m_titleblock_properties.date.isValid())
{ {
@@ -174,16 +125,8 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
DiagramContext new_context = old_context = elmt->elementInformations(); DiagramContext new_context = old_context = elmt->elementInformations();
for (QString key : QETApp::elementInfoKeys()) for (QString key : QETApp::elementInfoKeys())
{ {
QString value = m_element_context.value(key).toString(); new_context.addValue(key, applyChange(old_context.value(key).toString(),
if (value.isEmpty()) { m_element_context.value(key).toString()));
continue;
}
if (value == eraseText()) {
new_context.addValue(key, QString());
} else {
new_context.addValue(key, value);
}
} }
if (old_context != new_context) if (old_context != new_context)