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.
if (elmt->linkType() == Element::Master ||
elmt->linkType() == Element::Simple ||
elmt->linkType() == Element::Terminale)
elmt->linkType() == Element::Terminale ||
elmt->linkType() == Element::Thumbnail)
{
DiagramContext old_context;
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(":diagram_uuid", element->diagram()->uuid().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());
if (!m_insert_elements_query.exec()) {
qDebug() << "projectDataBase::addElement insert element error : " << m_insert_elements_query.lastError();
@ -440,7 +440,7 @@ void projectDataBase::populateElementInfoTable()
for (auto *diagram : m_project->diagrams())
{
ElementProvider ep(diagram);
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master| Element::Thumbnail);
QList<Element *> elements_list = ep.find(Element::Simple | Element::Terminale | Element::Master | Element::Thumbnail);
//Insert all value into the database
for (auto elmt : elements_list)

View File

@ -45,7 +45,7 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
m_button_group.addButton(ui->m_button_cb, 3);
m_button_group.addButton(ui->m_coil_cb, 4);
m_button_group.addButton(ui->m_protection_cb, 5);
m_button_group.addButton(ui->m_thumbnail_cb,6);
m_button_group.addButton(ui->m_thumbnail_cb, 6);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) // ### Qt 6: remove
connect(&m_button_group, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), [this](int id)
#else
@ -345,7 +345,7 @@ QString ElementQueryWidget::queryStr() const
}
if (ui->m_thumbnail_cb->isChecked()) {
if (b) where +=" OR";
where += " element_type = 'thumbnail'";
where += " element_type = 'Thumbnail'";
b = true;
}
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;
if (type_ == ElementData::Slave ||
type_ == ElementData::Master ||
type_ == ElementData::Terminale)
type_ == ElementData::Terminale ||
type_ == ElementData::Thumbnail)
{
root.appendChild(m_element_data.kindInfoToXml(xml_document));
}
if(type_ == ElementData::Simple ||
type_ == ElementData::Master ||
type_ == ElementData::Terminale)
type_ == ElementData::Terminale||
type_ == ElementData::Thumbnail)
{
QDomElement element_info = xml_document.createElement("elementInformations");
m_element_data.m_informations.toXml(element_info, "elementInformation");

View File

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

View File

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

View File

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