works again
This commit is contained in:
@@ -27,6 +27,7 @@ const QString c_Version = "0.1.1 04.09.2024";
|
|||||||
const QString c_ItemType = "ItemType";
|
const QString c_ItemType = "ItemType";
|
||||||
const QString c_Caption = "Caption";
|
const QString c_Caption = "Caption";
|
||||||
const QString c_Header = "Header";
|
const QString c_Header = "Header";
|
||||||
|
const QString c_ContentType = "ContentType";
|
||||||
|
|
||||||
const QString c_MainModelName = "DocumentTreeModel";
|
const QString c_MainModelName = "DocumentTreeModel";
|
||||||
const QString c_ChildModelName = "DocumentDetailsModel";
|
const QString c_ChildModelName = "DocumentDetailsModel";
|
||||||
|
@@ -31,73 +31,7 @@ XQChildModel::XQChildModel( QObject *parent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! erzeugt die basisstruktur des models.
|
//! erzegt den sichtbaren inhalt des models aus einem root-datenknoten.
|
||||||
/*
|
|
||||||
void XQChildModel::initModel(const QString& modelName)
|
|
||||||
{
|
|
||||||
|
|
||||||
auto extendItemType = [=,this](const XQNodePtr& entry)
|
|
||||||
{
|
|
||||||
const QString& typeName = entry->attribute("ItemType");
|
|
||||||
XQItemType* itemType = _itemFactory.findItemTypeTemplate( typeName); // throws
|
|
||||||
// über alle attribute
|
|
||||||
for (const auto& attr : entry->attributes())
|
|
||||||
{
|
|
||||||
// prüfen, ob der itemType des attribute schon hat
|
|
||||||
int role = itemType->hasAttribute( attr.first);
|
|
||||||
// wenn ja, überschreiben
|
|
||||||
if( role != XQItem::NoRole )
|
|
||||||
{
|
|
||||||
QVariant newValue = _itemFactory.makeVariant(role,attr.second);
|
|
||||||
itemType->replaceAttribute( newValue, role );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// #0: Wir suchen die Model-Beschreibung
|
|
||||||
XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws
|
|
||||||
|
|
||||||
// #1: Wir erzeugen die Model-Struktur: Jedes Kind beschreibt einen
|
|
||||||
// XML-Datentyp, z.B. <Panel atr1="..." />, <Battery .../>
|
|
||||||
// Jeder XML-Knoten entspricht einer Zeile im späteren Model, jedes
|
|
||||||
// Attribut wird einem eigenen Feld (XQItem) abgebildet.
|
|
||||||
|
|
||||||
for( const auto& sheetNode : modelSheet->children() )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
XQItemList list = _itemFactory.makeHeaderRow( sheetNode );
|
|
||||||
|
|
||||||
// für jeden XML-Knotentyp in der Modelbeschreibung erzeugen wir eine section
|
|
||||||
addSection(list, sheetNode );
|
|
||||||
|
|
||||||
// jedes kind kann enthält einen itemType und einen headerItemType. Für
|
|
||||||
// diese sind eventuell weitere attribute vorhanden, die die im type
|
|
||||||
// enthaltenen defualt-werte überschreiben.
|
|
||||||
|
|
||||||
for( const auto& sheetChild : sheetNode->children() )
|
|
||||||
{
|
|
||||||
//qDebug() << "---- kloppo: " << sheetChild->tag_name() << ": " << sheetChild->to_string();
|
|
||||||
extendItemType( sheetChild );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// empty row:
|
|
||||||
// XQNodePtr contentNode = XQNode::make_node( sheetNode->tag_name() );
|
|
||||||
// XQItemList emptyRow = _itemFactory.makeEmptyRow( contentNode, sheetNode );
|
|
||||||
// appendRow( emptyRow );
|
|
||||||
|
|
||||||
|
|
||||||
} // for
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//! erzegut den sichtbaren inhalt des models aus einem root-datenknoten.
|
|
||||||
|
|
||||||
void XQChildModel::setContent( const XQNodePtr& contentRoot )
|
void XQChildModel::setContent( const XQNodePtr& contentRoot )
|
||||||
{
|
{
|
||||||
@@ -113,14 +47,20 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot )
|
|||||||
// haben, hier: <Panel>. <Battery> ...
|
// haben, hier: <Panel>. <Battery> ...
|
||||||
for (const auto& contentEntry : _contentRoot->children())
|
for (const auto& contentEntry : _contentRoot->children())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
qDebug() << " --- GOGOGO: 00: " << contentEntry->to_string();
|
||||||
|
|
||||||
// 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();
|
||||||
|
qDebug() << " --- GOGOGO: " << key;
|
||||||
|
|
||||||
// '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))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
qDebug() << " --- GOGOGO: FOUND!" << key;
|
||||||
|
|
||||||
XQModelSection& section = _sections.at( key );
|
XQModelSection& section = _sections.at( key );
|
||||||
// wir speichern das parent des datenknoten auch in der
|
// wir speichern das parent des datenknoten auch in der
|
||||||
// section.
|
// section.
|
||||||
@@ -128,8 +68,10 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot )
|
|||||||
section.contentRootNode = contentEntry->parent();
|
section.contentRootNode = contentEntry->parent();
|
||||||
int newRow = _sections.lastRow(section);
|
int newRow = _sections.lastRow(section);
|
||||||
|
|
||||||
//qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow;
|
XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, contentEntry );
|
||||||
XQItemList list = _itemFactory.makeContentRow( contentEntry, section.sheetRootNode );
|
|
||||||
|
qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow;
|
||||||
|
|
||||||
// als Baum?
|
// als Baum?
|
||||||
//section.headerItem().appendRow( list );
|
//section.headerItem().appendRow( list );
|
||||||
insertRow( newRow, list);
|
insertRow( newRow, list);
|
||||||
|
@@ -39,6 +39,7 @@ XQMainModel::XQMainModel(QObject *parent )
|
|||||||
|
|
||||||
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
|
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
|
||||||
{
|
{
|
||||||
|
|
||||||
for(const auto& section : _sections )
|
for(const auto& section : _sections )
|
||||||
{
|
{
|
||||||
qDebug() << " --- wtf1: " << contentNode->to_string();
|
qDebug() << " --- wtf1: " << contentNode->to_string();
|
||||||
|
@@ -34,12 +34,34 @@ XQMainWindow::XQMainWindow( QWidget* parent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// setzt das working directory: dieses muss das 'xml' datenverzeichnis enthalten.
|
||||||
|
|
||||||
|
void XQMainWindow::setupWorkingDir()
|
||||||
|
{
|
||||||
|
QDir dir = QDir::current();
|
||||||
|
|
||||||
|
while (dir.exists())
|
||||||
|
{
|
||||||
|
QString xmlPath = dir.absoluteFilePath("xml");
|
||||||
|
if (QDir(xmlPath).exists())
|
||||||
|
{
|
||||||
|
qDebug() << " --- CD TO: " << dir.absolutePath();
|
||||||
|
QDir::setCurrent( dir.absolutePath() );
|
||||||
|
}
|
||||||
|
if (!dir.cdUp())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! actions & document struktur einrichten.
|
//! actions & document struktur einrichten.
|
||||||
|
|
||||||
void XQMainWindow::initMainWindow()
|
void XQMainWindow::initMainWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
qDebug() << " --- initMainWindow(): here we go!";
|
qDebug() << " --- initMainWindow(): here we go!";
|
||||||
|
// das working dir setzen: 'xml' muss als unterverzeichnis vorhanden sein.
|
||||||
|
setupWorkingDir();
|
||||||
|
|
||||||
// als allererstes laden wir die Modelschreibungen
|
// als allererstes laden wir die Modelschreibungen
|
||||||
XQItemFactory::instance().initItemFactory( c_ModelSheetFileName );
|
XQItemFactory::instance().initItemFactory( c_ModelSheetFileName );
|
||||||
@@ -295,11 +317,12 @@ void XQMainWindow::loadDocument( const QString& fileName )
|
|||||||
// read the model data
|
// read the model data
|
||||||
childModel->setContent( contentRoot->first_child() );
|
childModel->setContent( contentRoot->first_child() );
|
||||||
|
|
||||||
|
/*
|
||||||
// create new entry in the left side main tree view
|
// create new entry in the left side main tree view
|
||||||
|
|
||||||
XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
||||||
_mainTreeView->setCurrentIndex( newEntry->index() );
|
_mainTreeView->setCurrentIndex( newEntry->index() );
|
||||||
_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
|
_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,6 +51,8 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void setupWorkingDir();
|
||||||
|
|
||||||
// fixme implement
|
// fixme implement
|
||||||
void showDocumnet( const QString& key ){}
|
void showDocumnet( const QString& key ){}
|
||||||
void loadDocument( const QString& fileName );
|
void loadDocument( const QString& fileName );
|
||||||
|
@@ -28,7 +28,7 @@ void XQItemFactory::initItemFactory( const QString& modelSheetFileName )
|
|||||||
// über alle attribute
|
// über alle attribute
|
||||||
for( const auto& [key,value] : sheetNode->attributes() )
|
for( const auto& [key,value] : sheetNode->attributes() )
|
||||||
{
|
{
|
||||||
qDebug() << " --- conf item Type: " << key << " : " << value;
|
//qDebug() << " --- conf item Type: " << key << " : " << value;
|
||||||
setItemDataFromString( *itemType, key, value );
|
setItemDataFromString( *itemType, key, value );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -97,6 +97,8 @@ XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry )
|
|||||||
return itemType;
|
return itemType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! firz!
|
||||||
|
|
||||||
XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const
|
XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const
|
||||||
{
|
{
|
||||||
if( !key.isEmpty() && s_ItemTypeTemplates.contains(key))
|
if( !key.isEmpty() && s_ItemTypeTemplates.contains(key))
|
||||||
@@ -105,6 +107,8 @@ XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! firz!
|
||||||
|
|
||||||
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->find_child_by_tag_name( modelName );
|
||||||
@@ -115,26 +119,7 @@ XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! firz!
|
||||||
XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetEntry )
|
|
||||||
{
|
|
||||||
// header items are all non-data items:
|
|
||||||
// - section header row items
|
|
||||||
// - main tree header items
|
|
||||||
// - main tree child items
|
|
||||||
// - also: static items, hidden items
|
|
||||||
|
|
||||||
// den itemtype des neuen items rausfinden
|
|
||||||
QString typeKey = sheetEntry->attribute("HeaderItemType");
|
|
||||||
//XQItemType* itemType = makeItemType(sheetEntry); // throws
|
|
||||||
XQItemType* itemType = findItemTypeTemplate(typeKey);
|
|
||||||
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
|
||||||
const QString* contentPtr = sheetEntry->attribute_ptr("HeaderCaption");
|
|
||||||
|
|
||||||
return new XQItem( itemType, contentPtr );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
XQItem* XQItemFactory::makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry )
|
XQItem* XQItemFactory::makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry )
|
||||||
{
|
{
|
||||||
@@ -150,6 +135,9 @@ XQItem* XQItemFactory::makeTreeChildItem( const XQNodePtr& contentNode, const XQ
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! firz!
|
||||||
|
|
||||||
void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const
|
void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const
|
||||||
{
|
{
|
||||||
int dataRole = XQItem::fetchItemDataRole( roleKey );
|
int dataRole = XQItem::fetchItemDataRole( roleKey );
|
||||||
@@ -162,6 +150,8 @@ void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//! firz!
|
||||||
|
|
||||||
QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
|
QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -283,23 +273,15 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
|
|||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry )
|
//! erzeugt ein XQItem aus einer typ-beschreibung ('sheetNode') und einem daten-knoten ('contentNode').
|
||||||
{
|
//! wenn der content node nicht gesetzt ist, wird stattdess das attribut 'Caption' aus der typ-beschreibung
|
||||||
// den itemtype des neuen items rausfinden
|
//! verwendet: es handelt sich dann um ein header item, das erzeugt wurde.
|
||||||
QString typeKey = sheetEntry->attribute(c_ItemType);
|
|
||||||
//XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
|
|
||||||
XQItemType* itemType = makeItemType(sheetEntry); // throws
|
|
||||||
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
|
||||||
const QString* contentPtr = contentNode->attribute_ptr( sheetEntry->tag_name() );
|
|
||||||
|
|
||||||
return new XQItem( itemType, contentPtr );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||||
{
|
{
|
||||||
// den itemtype des neuen items rausfinden
|
// den itemtype des neuen items rausfinden
|
||||||
QString typeKey = sheetNode->attribute(c_ItemType);
|
QString typeKey = sheetNode->attribute(c_ItemType);
|
||||||
|
qDebug() << " --- makeItem: typeKey: " << typeKey << ": " << sheetNode->to_string();
|
||||||
//XQItemType* itemType = makeItemType(sheetEntry); // throws
|
//XQItemType* itemType = makeItemType(sheetEntry); // throws
|
||||||
XQItemType* itemType = findItemTypeTemplate(typeKey);
|
XQItemType* itemType = findItemTypeTemplate(typeKey);
|
||||||
// fallunterscheidung beim inhalt:
|
// fallunterscheidung beim inhalt:
|
||||||
@@ -315,14 +297,14 @@ XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XQItemList XQItemFactory::makeHeader( const XQNodePtr& headerNode )
|
XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& headerNode )
|
||||||
{
|
{
|
||||||
|
|
||||||
XQItemList list;
|
XQItemList list;
|
||||||
// über alle kinder der <Header> sektion
|
// über alle kinder der <Header> sektion
|
||||||
for( const auto& headerEntry : headerNode->children() )
|
for( const auto& headerEntry : headerNode->children() )
|
||||||
{
|
{
|
||||||
qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption");
|
//qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption");
|
||||||
XQItem* headerItem = makeItem( headerEntry );
|
XQItem* headerItem = makeItem( headerEntry );
|
||||||
list.append( headerItem );
|
list.append( headerItem );
|
||||||
}
|
}
|
||||||
@@ -332,36 +314,9 @@ XQItemList XQItemFactory::makeHeader( const XQNodePtr& headerNode )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& sheetNode )
|
//! erzeugt eine header item row.
|
||||||
{
|
|
||||||
XQItemList list;
|
|
||||||
// Die Kinder des Knotens beschreiben die einzelnen
|
|
||||||
// Attribute des XML-Datenknotens
|
|
||||||
for( const auto& attrNode : sheetNode->children() )
|
|
||||||
{
|
|
||||||
// ??
|
|
||||||
//if(attrNode->has_children() )
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
XQItem* headerItem = makeHeaderItem( attrNode );
|
XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||||
list.append( headerItem );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !list.empty() )
|
|
||||||
{
|
|
||||||
// wir merken uns den original content node auch, aber
|
|
||||||
// im ersten Item.
|
|
||||||
dynamic_cast<XQItem*>(list[0])->setContentNode(sheetNode);
|
|
||||||
// brauchen wir den noch?
|
|
||||||
dynamic_cast<XQItem*>(list[0])->setSheetNode(sheetNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// no clone here !
|
|
||||||
XQItemList XQItemFactory::makeContentRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
XQItemList list;
|
XQItemList list;
|
||||||
@@ -378,7 +333,7 @@ XQItemList XQItemFactory::makeContentRow( const XQNodePtr& contentNode, const XQ
|
|||||||
|
|
||||||
for( const auto& sheetEntry : sheetNode->children() )
|
for( const auto& sheetEntry : sheetNode->children() )
|
||||||
{
|
{
|
||||||
list.append( makeContentItem( contentNode, sheetEntry ) );
|
list.append( makeItem( sheetEntry, contentNode ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !list.empty() )
|
if( !list.empty() )
|
||||||
@@ -392,6 +347,7 @@ XQItemList XQItemFactory::makeContentRow( const XQNodePtr& contentNode, const XQ
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
XQItemList XQItemFactory::makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode )
|
XQItemList XQItemFactory::makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode )
|
||||||
{
|
{
|
||||||
Q_UNUSED(contentNode)
|
Q_UNUSED(contentNode)
|
||||||
@@ -408,8 +364,9 @@ XQItemList XQItemFactory::makeEmptyRow( const XQNodePtr& contentNode, const XQNo
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode )
|
XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode )
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -429,3 +386,4 @@ XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const
|
|||||||
return makeContentRow(contentNode, sheetNode );
|
return makeContentRow(contentNode, sheetNode );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
@@ -32,20 +32,17 @@ public:
|
|||||||
|
|
||||||
XQNodePtr findModelSheet( const QString& modelName ) const;
|
XQNodePtr findModelSheet( const QString& modelName ) const;
|
||||||
|
|
||||||
XQItem* makeHeaderItem(const XQNodePtr& typeSheetNode );
|
|
||||||
XQItem* makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry );
|
|
||||||
XQItem* makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry );
|
XQItem* makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry );
|
||||||
|
|
||||||
XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr);
|
XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr);
|
||||||
XQItemList makeHeader( const XQNodePtr& sheetNode );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
XQItemList makeHeaderRow( const XQNodePtr& sheetNode );
|
XQItemList makeHeaderRow( const XQNodePtr& sheetNode );
|
||||||
XQItemList makeContentRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||||
XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
//XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||||
|
|
||||||
// wozu ist das gut?
|
// wozu ist das gut?
|
||||||
XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
//XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||||
|
|
||||||
void setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const;
|
void setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const;
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ QVariant XQItemType::data( int role ) const
|
|||||||
|
|
||||||
void XQItemType::setData(const QVariant& value, int role )
|
void XQItemType::setData(const QVariant& value, int role )
|
||||||
{
|
{
|
||||||
qDebug() << " --- itemType set Data:" << role << " : " << value.toString();
|
//qDebug() << " --- itemType set Data:" << role << " : " << value.toString();
|
||||||
return QStandardItem::setData(value,role);
|
return QStandardItem::setData(value,role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -61,8 +61,12 @@ XQItem& XQModelSection::XQModelSection::headerItem() const
|
|||||||
|
|
||||||
void XQModelSectionList::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode)
|
void XQModelSectionList::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode)
|
||||||
{
|
{
|
||||||
XQModelSection section(idx, sheetNode);
|
if( !sheetNode->has_attribute( c_ContentType) )
|
||||||
addAtKey(sheetNode->tag_name(), section);
|
throw XQException( "section list: Section node needs attribute 'ContentType'!");
|
||||||
|
|
||||||
|
XQModelSection section(idx, sheetNode->find_child_by_tag_name("Data"));
|
||||||
|
qDebug() << " ---- ADD section: " << sheetNode->attribute( c_ContentType);
|
||||||
|
addAtKey(sheetNode->attribute( c_ContentType), section);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XQModelSectionList::hasValidSection(const QString& sectionKey) const
|
bool XQModelSectionList::hasValidSection(const QString& sectionKey) const
|
||||||
|
@@ -108,7 +108,7 @@ void XQViewModel::initModel(const QString& modelName)
|
|||||||
const XQNodePtr header = section->find_child_by_tag_name( "Header");
|
const XQNodePtr header = section->find_child_by_tag_name( "Header");
|
||||||
if( header )
|
if( header )
|
||||||
{
|
{
|
||||||
XQItemList list = _itemFactory.makeHeader( header );
|
XQItemList list = _itemFactory.makeHeaderRow( header );
|
||||||
Q_ASSERT(!list.isEmpty());
|
Q_ASSERT(!list.isEmpty());
|
||||||
addSection(list, section );
|
addSection(list, section );
|
||||||
}
|
}
|
||||||
|
@@ -170,6 +170,9 @@ namespace znode
|
|||||||
typename zattributes::const_iterator pos = _attributes.find(key);
|
typename zattributes::const_iterator pos = _attributes.find(key);
|
||||||
if( pos == _attributes.end() )
|
if( pos == _attributes.end() )
|
||||||
return false;
|
return false;
|
||||||
|
// leer gilded nicht
|
||||||
|
if( xstr_is_empty( pos->second ) )
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
|
||||||
<Project ProjectID="HA01" FriendlyName="@ProjectName" ProjectName="Wiebelbach West" Established="2006" WattPeak="84000" State="runnning" LastFileName="modelData1.xtr">
|
<Project ProjectID="HA01" FriendlyName="@ProjectName" ProjectName="Wiebelbach West" Established="2006" WattPeak="84000" ContentType="runnning" LastFileName="modelData1.xtr">
|
||||||
<Components>
|
<Components>
|
||||||
|
|
||||||
<Panel PanelID="#1 JA 01" FriendlyName="@PanelName" PanelName="JA 01 Solar T62B" Manufacturer="JA Solar 1 XX" WattPeak="620" Height="2,70" Width="1,10" Weight="12" MaxVolt="67" MaxAmpere="11">
|
<Panel PanelID="#1 JA 01" FriendlyName="@PanelName" PanelName="JA 01 Solar T62B" Manufacturer="JA Solar 1 XX" WattPeak="620" Height="2,70" Width="1,10" Weight="12" MaxVolt="67" MaxAmpere="11">
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
|
||||||
|
|
||||||
<Project ProjectID="HA02" FriendlyName="@ProjectName" ProjectName="Gerbrunn Ost" Established="2006" WattPeak="9840" State="planned">
|
<Project ProjectID="HA02" FriendlyName="@ProjectName" ProjectName="Gerbrunn Ost" Established="2006" WattPeak="9840" ContentType="planned">
|
||||||
<Components>
|
<Components>
|
||||||
<Panel PanelID="Jingli 01" FriendlyName="@PanelName" PanelName="Jingli 01 Solar T62B" Manufacturer="Jingli Solar" WattPeak="620" Height="2,70" Width="1,10" Weight="12" MaxVolt="67" MaxAmpere="11">
|
<Panel PanelID="Jingli 01" FriendlyName="@PanelName" PanelName="Jingli 01 Solar T62B" Manufacturer="Jingli Solar" WattPeak="620" Height="2,70" Width="1,10" Weight="12" MaxVolt="67" MaxAmpere="11">
|
||||||
<AdditionalData DataItem="Image" DataValue="image,png"/>
|
<AdditionalData DataItem="Image" DataValue="image,png"/>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
|
||||||
<Project ProjectID="HA03" FriendlyName="@ProjectName" ProjectName="Neubrunn Süd" Established="2006" WattPeak="9840" State="runnning">
|
<Project ProjectID="HA03" FriendlyName="@ProjectName" ProjectName="Neubrunn Süd" Established="2006" WattPeak="9840" ContentType="runnning">
|
||||||
<Components>
|
<Components>
|
||||||
<Panel PanelID="AIKO 01" FriendlyName="@PanelName" PanelName="AIKO 01 Solar T62B" Manufacturer="AIKO Solar" WattPeak="620" Height="2,70" Width="1,10" Weight="12" MaxVolt="67" MaxAmpere="11">
|
<Panel PanelID="AIKO 01" FriendlyName="@PanelName" PanelName="AIKO 01 Solar T62B" Manufacturer="AIKO Solar" WattPeak="620" Height="2,70" Width="1,10" Weight="12" MaxVolt="67" MaxAmpere="11">
|
||||||
<AdditionalData DataItem="Image" DataValue="image.png"/>
|
<AdditionalData DataItem="Image" DataValue="image.png"/>
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
DocumentDetailsModel:
|
DocumentDetailsModel:
|
||||||
-->
|
-->
|
||||||
<DocumentTreeModel>
|
<DocumentTreeModel>
|
||||||
<Section State="runnning">
|
<Section ContentType="runnning">
|
||||||
<Header>
|
<Header>
|
||||||
<Entry Caption="Active Projects" ItemType="TreeParentType"/>
|
<Entry Caption="Active Projects" ItemType="TreeParentType"/>
|
||||||
</Header>
|
</Header>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<Project Caption="@ProjectName" ItemType="TreeParentType"/>
|
<Project Caption="@ProjectName" ItemType="TreeParentType"/>
|
||||||
</Data>
|
</Data>
|
||||||
</Section>
|
</Section>
|
||||||
<Section State="planned">
|
<Section ContentType="planned">
|
||||||
<Header>
|
<Header>
|
||||||
<Entry Caption="Planned Projects" ItemType="TreeParentType"/>
|
<Entry Caption="Planned Projects" ItemType="TreeParentType"/>
|
||||||
</Header>
|
</Header>
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<Project Caption="@ProjectName" ItemType="TreeParentType"/>
|
<Project Caption="@ProjectName" ItemType="TreeParentType"/>
|
||||||
</Data>
|
</Data>
|
||||||
</Section>
|
</Section>
|
||||||
<Section State="finished">
|
<Section ContentType="finished">
|
||||||
<Header>
|
<Header>
|
||||||
<Entry Caption="Finished Projects" ItemType="TreeParentType"/>
|
<Entry Caption="Finished Projects" ItemType="TreeParentType"/>
|
||||||
</Header>
|
</Header>
|
||||||
@@ -74,8 +74,8 @@
|
|||||||
|
|
||||||
<DocumentDetailsModel>
|
<DocumentDetailsModel>
|
||||||
|
|
||||||
<Section>
|
<Section ContentType="Panel">
|
||||||
<Header>
|
<Header Marker="Panel">
|
||||||
<PanelID Caption="Panel" ItemType="HeaderType" />
|
<PanelID Caption="Panel" ItemType="HeaderType" />
|
||||||
<PanelName Caption="Name" ItemType="HeaderType" Icon="BrowserStop" />
|
<PanelName Caption="Name" ItemType="HeaderType" Icon="BrowserStop" />
|
||||||
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
||||||
@@ -101,8 +101,8 @@
|
|||||||
</Data>
|
</Data>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section>
|
<Section ContentType="Inverter">
|
||||||
<Header>
|
<Header Marker="Inverter">
|
||||||
<InverterID Caption="Inverter" ItemType="HeaderType" />
|
<InverterID Caption="Inverter" ItemType="HeaderType" />
|
||||||
<InverterName Caption="Name" ItemType="HeaderType" />
|
<InverterName Caption="Name" ItemType="HeaderType" />
|
||||||
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
||||||
@@ -122,8 +122,8 @@
|
|||||||
</Data>
|
</Data>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<Section>
|
<Section ContentType="Battery">
|
||||||
<Header>
|
<Header Marker="Battery">
|
||||||
<BatteryID Caption="Name" ItemType="HeaderType" />
|
<BatteryID Caption="Name" ItemType="HeaderType" />
|
||||||
<BatteryName Caption="Battery" ItemType="HeaderType" />
|
<BatteryName Caption="Battery" ItemType="HeaderType" />
|
||||||
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
||||||
|
Reference in New Issue
Block a user