some renamings.
This commit is contained in:
@@ -31,6 +31,22 @@ XQChildModel::XQChildModel( QObject *parent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//! Erzeugt eine model-section und fügt den zugehörigen header ein.
|
||||||
|
|
||||||
|
void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& contentEntry )
|
||||||
|
{
|
||||||
|
const XQModelSection& section = _sections.sectionByKey( key );
|
||||||
|
if(section.isValid() )
|
||||||
|
{
|
||||||
|
section.setContentRootNode( contentEntry->parent() );
|
||||||
|
int newRow =_sections.lastRow(section);
|
||||||
|
XQNodePtr sheetNode = section.sheetRootNode();
|
||||||
|
XQItemList list = _itemFactory.makeRow( sheetNode, nullptr );
|
||||||
|
insertRow( newRow, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//! erzegt den sichtbaren inhalt des models aus einem root-datenknoten.
|
//! erzegt den sichtbaren inhalt des models aus einem root-datenknoten.
|
||||||
|
|
||||||
void XQChildModel::addModelData( const XQNodePtr& contentRoot )
|
void XQChildModel::addModelData( const XQNodePtr& contentRoot )
|
||||||
@@ -46,7 +62,6 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot )
|
|||||||
// Das ist hier der Typ des Eintrags: Panel, Battery ...
|
// Das ist hier der Typ des Eintrags: Panel, Battery ...
|
||||||
QString key = contentEntry->tag_name();
|
QString key = contentEntry->tag_name();
|
||||||
|
|
||||||
|
|
||||||
// 'silent failure' hier der Datenbaum kann auch Knoten enthalten
|
// 'silent failure' hier der Datenbaum kann auch Knoten enthalten
|
||||||
// die nicht für uns gedacht sind.
|
// die nicht für uns gedacht sind.
|
||||||
if (!_sections.hasValidSection(key))
|
if (!_sections.hasValidSection(key))
|
||||||
@@ -69,28 +84,28 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot )
|
|||||||
{
|
{
|
||||||
qDebug() << " --- AddModelData: CHILD Found for: :" << contentEntry->tag_name() << " sheet parent: " << sheetNode->tag_name();
|
qDebug() << " --- AddModelData: CHILD Found for: :" << contentEntry->tag_name() << " sheet parent: " << sheetNode->tag_name();
|
||||||
if( !sheetNode->has_children() )
|
if( !sheetNode->has_children() )
|
||||||
qDebug() << " --- AUA";
|
{
|
||||||
//else
|
qDebug() << " --- no sheet node for children";
|
||||||
|
continue;
|
||||||
|
}Sehr geehrte Frau Hollerbaum,
|
||||||
|
|
||||||
|
Derzeit in Festanstellung, kann mir aber bin aber offen
|
||||||
|
|
||||||
|
Mein Fachgebiet ist Qt ma
|
||||||
|
addSectionChildren( list.front(), sheetNode, contentEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // for
|
} // for
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XQChildModel::addSectionChildren( QStandardItem* parent, const XQNodePtr& sheetEntry, const XQNodePtr& contentRoot )
|
||||||
//! Erzeugt eine model-section und fügt den zugehörigen header ein.
|
|
||||||
|
|
||||||
void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& contentEntry )
|
|
||||||
{
|
{
|
||||||
const XQModelSection& section = _sections.sectionByKey( key );
|
for (const auto& contentEntry : contentRoot->children())
|
||||||
if(section.isValid() )
|
|
||||||
{
|
{
|
||||||
section.setContentRootNode( contentEntry->parent() );
|
|
||||||
int newRow =_sections.lastRow(section);
|
|
||||||
XQNodePtr sheetNode = section.sheetRootNode();
|
|
||||||
XQItemList list = _itemFactory.makeRow( sheetNode, nullptr );
|
|
||||||
insertRow( newRow, list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ public:
|
|||||||
|
|
||||||
void addModelData(const XQNodePtr& contentRoot );
|
void addModelData(const XQNodePtr& contentRoot );
|
||||||
void addSectionEntry( const QString& key, const XQNodePtr& contentEntry );
|
void addSectionEntry( const QString& key, const XQNodePtr& contentEntry );
|
||||||
|
void addSectionChildren( QStandardItem* parent, const XQNodePtr& sheetEntry, const XQNodePtr& contentEntry );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
|
|||||||
|
|
||||||
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
|
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
|
||||||
{
|
{
|
||||||
XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection");
|
XQNodePtr sheetNode = projectItem->sheetNode()->child("CurrentSection");
|
||||||
XQItem* newItem = _itemFactory.makeSingleItem( sheetNode, section.contentType() );
|
XQItem* newItem = _itemFactory.makeSingleItem( sheetNode, section.contentType() );
|
||||||
projectItem->appendRow( newItem );
|
projectItem->appendRow( newItem );
|
||||||
expandNewItem(projectItem->index() );
|
expandNewItem(projectItem->index() );
|
||||||
|
@@ -42,7 +42,7 @@ void XQItemFactory::initItemFactory( const QString& modelSheetFileName )
|
|||||||
throw XQException("modelSheet load failed. ", modelSheetFileName);
|
throw XQException("modelSheet load failed. ", modelSheetFileName);
|
||||||
|
|
||||||
// schritt #3: itemtype beschreibungen laden ...
|
// schritt #3: itemtype beschreibungen laden ...
|
||||||
_typesSheet = _modelSheet->find_child_by_tag_name( "ItemTypes" );
|
_typesSheet = _modelSheet->child( "ItemTypes" );
|
||||||
// ... und testen
|
// ... und testen
|
||||||
if( !_typesSheet )
|
if( !_typesSheet )
|
||||||
throw XQException( "initItemFactory <ItemTypes> is null" );
|
throw XQException( "initItemFactory <ItemTypes> is null" );
|
||||||
@@ -114,7 +114,7 @@ XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const
|
|||||||
|
|
||||||
XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const
|
XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const
|
||||||
{
|
{
|
||||||
XQNodePtr modelSheet = _modelSheet->find_child_by_tag_name( modelName );
|
XQNodePtr modelSheet = _modelSheet->child( modelName );
|
||||||
if( !modelSheet )
|
if( !modelSheet )
|
||||||
throw XQException( "model sheet not found: ", modelName );
|
throw XQException( "model sheet not found: ", modelName );
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ XQNodePtr XQModelSection::sectionRootNode() const
|
|||||||
|
|
||||||
XQNodePtr XQModelSection::sheetRootNode() const
|
XQNodePtr XQModelSection::sheetRootNode() const
|
||||||
{
|
{
|
||||||
return _sectionSheetRootNode->find_child_by_tag_name( c_ModelSheet );
|
return _sectionSheetRootNode->child( c_ModelSheet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -139,7 +139,7 @@ void XQViewModel::initModel(const QString& modelName)
|
|||||||
for( auto& sectionNode : modelSheet->children() )
|
for( auto& sectionNode : modelSheet->children() )
|
||||||
{
|
{
|
||||||
// #2: (optionalen?) header erzeugen
|
// #2: (optionalen?) header erzeugen
|
||||||
const XQNodePtr header = sectionNode->find_child_by_tag_name( c_Header );
|
const XQNodePtr header = sectionNode->child( c_Header );
|
||||||
if( header )
|
if( header )
|
||||||
{
|
{
|
||||||
XQItemList list = _itemFactory.makeRow( header, nullptr );
|
XQItemList list = _itemFactory.makeRow( header, nullptr );
|
||||||
|
@@ -206,6 +206,12 @@ namespace znode
|
|||||||
return !children().empty();
|
return !children().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! testet, ob kinder vorhanden sind.
|
||||||
|
bool has_child(str_cref tagname ) const
|
||||||
|
{
|
||||||
|
return child(tagname ) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//! gibt das erste kind zurück
|
//! gibt das erste kind zurück
|
||||||
zshared_node first_child()
|
zshared_node first_child()
|
||||||
{
|
{
|
||||||
@@ -229,6 +235,17 @@ namespace znode
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
zshared_node child(str_cref tagname ) const
|
||||||
|
{
|
||||||
|
for( auto child : _children )
|
||||||
|
{
|
||||||
|
if( child->tag_name() == tagname )
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//! hängt einen knoten an meine kinderliste an.
|
//! hängt einen knoten an meine kinderliste an.
|
||||||
int add_child( const zshared_node& node )
|
int add_child( const zshared_node& node )
|
||||||
{
|
{
|
||||||
@@ -313,7 +330,7 @@ namespace znode
|
|||||||
|
|
||||||
//! findet den ersten kind-knoten mit dem attribut 'attrkey' welches den
|
//! findet den ersten kind-knoten mit dem attribut 'attrkey' welches den
|
||||||
//! wert 'attrvalue' hat.
|
//! wert 'attrvalue' hat.
|
||||||
zshared_node find_child_by_attribute(str_cref attrkey, str_cref attrvalue )
|
zshared_node find_child_by_attribute(str_cref attrkey, str_cref attrvalue ) const
|
||||||
{
|
{
|
||||||
for( auto child : _children )
|
for( auto child : _children )
|
||||||
{
|
{
|
||||||
@@ -323,18 +340,9 @@ namespace znode
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
zshared_node find_child_by_tag_name(str_cref tagname )
|
|
||||||
{
|
|
||||||
for( auto child : _children )
|
|
||||||
{
|
|
||||||
if( child->tag_name() == tagname )
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
zshared_node find_child_by_id( int id )
|
|
||||||
|
zshared_node find_child_by_id( int id ) const
|
||||||
{
|
{
|
||||||
for (auto child : _children )
|
for (auto child : _children )
|
||||||
{
|
{
|
||||||
|
@@ -630,7 +630,7 @@ namespace pugi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Find child node using predicate. Returns first child for which predicate returned true.
|
// Find child node using predicate. Returns first child for which predicate returned true.
|
||||||
template <typename Predicate> xml_node find_child_by_tag_name(Predicate pred) const
|
template <typename Predicate> xml_node child(Predicate pred) const
|
||||||
{
|
{
|
||||||
if (!_root) return xml_node();
|
if (!_root) return xml_node();
|
||||||
|
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
<Inverter InverterID="#4 D12K 04" FriendlyName="@InverterName" InverterName="04 HM600 S2 TMax" Manufacturer="Deye" MaxPowerInput="8000" MaxPowerInputChoice="6000;8000;12000" MaxPowerOutput="600" NumStrings="2" Weight="28"/>
|
<Inverter InverterID="#4 D12K 04" FriendlyName="@InverterName" InverterName="04 HM600 S2 TMax" Manufacturer="Deye" MaxPowerInput="8000" MaxPowerInputChoice="6000;8000;12000" MaxPowerOutput="600" NumStrings="2" Weight="28"/>
|
||||||
<Battery BatteryID="#1 BYD 01" FriendlyName="@BatteryName" BatteryName="01 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="90" MaxCurrent="120" MaxVolt="48">
|
<Battery BatteryID="#1 BYD 01" FriendlyName="@BatteryName" BatteryName="01 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="90" MaxCurrent="120" MaxVolt="48">
|
||||||
<Images FrontView="image.png" PackageView="package.png" InstalledView="installed.png"/>
|
<Images FrontView="image.png" PackageView="package.png" InstalledView="installed.png"/>
|
||||||
<Documents Manual="manual.docx" Certificate="certificate.pdf"/>
|
<Documents Manual="manual.docx" Installation="installation.pdf"/>
|
||||||
|
<Certificates Certificate="certificate.pdf" Conformity="conformity.pdf"/>
|
||||||
</Battery>
|
</Battery>
|
||||||
<Battery BatteryID="#2 BYD 02" FriendlyName="@BatteryName" BatteryName="02 BYD T02 Stackable" Manufacturer="BYD" Capacity="9000" Yield="94" MaxCurrent="120" MaxVolt="48"/>
|
<Battery BatteryID="#2 BYD 02" FriendlyName="@BatteryName" BatteryName="02 BYD T02 Stackable" Manufacturer="BYD" Capacity="9000" Yield="94" MaxCurrent="120" MaxVolt="48"/>
|
||||||
<Battery BatteryID="#3 BYD 03" FriendlyName="@BatteryName" BatteryName="03 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="86" MaxCurrent="120" MaxVolt="48"/>
|
<Battery BatteryID="#3 BYD 03" FriendlyName="@BatteryName" BatteryName="03 BYD T01 Stackable" Manufacturer="BYD" Capacity="4500" Yield="86" MaxCurrent="120" MaxVolt="48"/>
|
||||||
|
@@ -119,23 +119,28 @@
|
|||||||
<MaxVolt Caption="max. Volt" ItemType="HeaderType" />
|
<MaxVolt Caption="max. Volt" ItemType="HeaderType" />
|
||||||
</Header>
|
</Header>
|
||||||
<ModelSheet>
|
<ModelSheet>
|
||||||
<BatteryID ItemType="PlainType" />
|
<BatteryID ItemType="PlainType">
|
||||||
|
<Images>
|
||||||
|
<FrontView ItemType="PlainType"/>
|
||||||
|
<PackageView ItemType="PlainType"/>
|
||||||
|
<InstalledView ItemType="PlainType"/>
|
||||||
|
</Images >
|
||||||
|
<Documents>
|
||||||
|
<Manual ItemType="PlainType"/>
|
||||||
|
<Installation ItemType="PlainType"/>
|
||||||
|
</Documents>
|
||||||
|
<Certificates>
|
||||||
|
<Certificate ItemType="PlainType"/>
|
||||||
|
<Conformity ItemType="PlainType"/>
|
||||||
|
</Certificates>
|
||||||
|
</BatteryID>
|
||||||
<BatteryName ItemType="PlainType" />
|
<BatteryName ItemType="PlainType" />
|
||||||
<Manufacturer ItemType="PlainType" />
|
<Manufacturer ItemType="PlainType" />
|
||||||
<Capacity ItemType="ValueType" UnitType="Wh"/>
|
<Capacity ItemType="ValueType" UnitType="Wh"/>
|
||||||
<Yield ItemType="PercentageType" UnitType="%"/>
|
<Yield ItemType="PercentageType" UnitType="%"/>
|
||||||
<MaxCurrent ItemType="ValueType" UnitType="A">
|
<MaxCurrent ItemType="ValueType" UnitType="A"/>
|
||||||
<SubType ItemType="PlainType"/>
|
|
||||||
</MaxCurrent>
|
|
||||||
<MaxVolt ItemType="ValueType" UnitType="V"/>
|
<MaxVolt ItemType="ValueType" UnitType="V"/>
|
||||||
|
|
||||||
<firz ItemType="PlainType"/>
|
|
||||||
|
|
||||||
<Image DataValue="image.png" ItemType="PlainType"/>
|
|
||||||
<Manual DataValue="manual.docx" ItemType="PlainType"/>
|
|
||||||
<Certificate DataValue="certificate.pdf" ItemType="PlainType"/>
|
|
||||||
|
|
||||||
|
|
||||||
</ModelSheet>
|
</ModelSheet>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user