Element::Thumbnail WIP

This commit is contained in:
Laurent Trinques
2022-05-16 08:59:25 +02:00
parent db8c76c184
commit daeec311b2
7 changed files with 16 additions and 9 deletions

View File

@@ -123,7 +123,8 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
//We apply change only for master, slave, and terminal element. //We apply change only for master, slave, and terminal element.
if (elmt->linkType() == Element::Master || if (elmt->linkType() == Element::Master ||
elmt->linkType() == Element::Simple || elmt->linkType() == Element::Simple ||
elmt->linkType() == Element::Terminale) elmt->linkType() == Element::Terminale ||
elmt->linkType() == Element::Thumbnail)
{ {
DiagramContext old_context; DiagramContext old_context;
DiagramContext new_context = old_context = elmt->elementInformations(); DiagramContext new_context = old_context = elmt->elementInformations();

View File

@@ -118,7 +118,7 @@ void projectDataBase::addElement(Element *element)
m_insert_elements_query.bindValue(":uuid", element->uuid().toString()); m_insert_elements_query.bindValue(":uuid", element->uuid().toString());
m_insert_elements_query.bindValue(":diagram_uuid", element->diagram()->uuid().toString()); m_insert_elements_query.bindValue(":diagram_uuid", element->diagram()->uuid().toString());
m_insert_elements_query.bindValue(":pos", element->diagram()->convertPosition(element->scenePos()).toString()); m_insert_elements_query.bindValue(":pos", element->diagram()->convertPosition(element->scenePos()).toString());
m_insert_elements_query.bindValue(":type", element->linkTypeToString()); m_insert_elements_query.bindValue(":type", element->elementData().typeToString());
m_insert_elements_query.bindValue(":sub_type", element->kindInformations()["type"].toString()); m_insert_elements_query.bindValue(":sub_type", element->kindInformations()["type"].toString());
if (!m_insert_elements_query.exec()) { if (!m_insert_elements_query.exec()) {
qDebug() << "projectDataBase::addElement insert element error : " << m_insert_elements_query.lastError(); qDebug() << "projectDataBase::addElement insert element error : " << m_insert_elements_query.lastError();

View File

@@ -345,7 +345,7 @@ QString ElementQueryWidget::queryStr() const
} }
if (ui->m_thumbnail_cb->isChecked()) { if (ui->m_thumbnail_cb->isChecked()) {
if (b) where +=" OR"; if (b) where +=" OR";
where += " element_type = 'thumbnail'"; where += " element_type = 'Thumbnail'";
b = true; b = true;
} }
if (ui->m_simple_cb->isChecked()) { if (ui->m_simple_cb->isChecked()) {

View File

@@ -467,14 +467,16 @@ const QDomDocument ElementScene::toXml(bool all_parts)
auto type_ = m_element_data.m_type; auto type_ = m_element_data.m_type;
if (type_ == ElementData::Slave || if (type_ == ElementData::Slave ||
type_ == ElementData::Master || type_ == ElementData::Master ||
type_ == ElementData::Terminale) type_ == ElementData::Terminale ||
type_ == ElementData::Thumbnail)
{ {
root.appendChild(m_element_data.kindInfoToXml(xml_document)); root.appendChild(m_element_data.kindInfoToXml(xml_document));
} }
if(type_ == ElementData::Simple || if(type_ == ElementData::Simple ||
type_ == ElementData::Master || type_ == ElementData::Master ||
type_ == ElementData::Terminale) type_ == ElementData::Terminale||
type_ == ElementData::Thumbnail)
{ {
QDomElement element_info = xml_document.createElement("elementInformations"); QDomElement element_info = xml_document.createElement("elementInformations");
m_element_data.m_informations.toXml(element_info, "elementInformation"); m_element_data.m_informations.toXml(element_info, "elementInformation");

View File

@@ -312,7 +312,7 @@ QString ElementData::typeToString(ElementData::Type type)
case ElementData::Terminale : case ElementData::Terminale :
return QString("terminal"); return QString("terminal");
case ElementData::Thumbnail: case ElementData::Thumbnail:
return QString("thumbnail"); return QStringLiteral("thumbnail");
default: default:
qDebug() << "ElementData::typeToString : type don't exist" qDebug() << "ElementData::typeToString : type don't exist"
<< "return failsafe value 'simple'"; << "return failsafe value 'simple'";
@@ -334,7 +334,7 @@ ElementData::Type ElementData::typeFromString(const QString &string)
return ElementData::Slave; return ElementData::Slave;
} else if (string == "terminal") { } else if (string == "terminal") {
return ElementData::Terminale; return ElementData::Terminale;
} else if (string == "thumbnail") { } else if (string == QLatin1String("thumbnail")) {
return ElementData::Thumbnail; return ElementData::Thumbnail;
} }

View File

@@ -270,6 +270,8 @@ Element *DynamicElementTextItem::elementUseForInfo() const
{ {
case Element::Simple: case Element::Simple:
return elmt; return elmt;
case Element::Thumbnail:
return elmt;
case Element::NextReport: case Element::NextReport:
return elmt; return elmt;
case Element::PreviousReport: case Element::PreviousReport:

View File

@@ -1328,6 +1328,8 @@ QString Element::linkTypeToString() const
return QStringLiteral("Slave"); return QStringLiteral("Slave");
case Terminale: case Terminale:
return QStringLiteral("Terminale"); return QStringLiteral("Terminale");
case Thumbnail:
return QStringLiteral("Thumbnail");
default: default:
return QStringLiteral("Unknown"); return QStringLiteral("Unknown");
} }