7 Commits

Author SHA1 Message Date
eac668d297 removed XQIcon 2025-08-15 20:55:53 +02:00
c87da2802a backup 2025-08-15 20:31:40 +02:00
6865e6aaaa cleanups. 2025-08-14 22:03:31 +02:00
0d7ab33c74 reworked model sections. 2025-08-14 21:36:39 +02:00
Christoph Holzheuer
a6fb7e82bd works again 2025-08-14 19:13:53 +02:00
d3f2cbeaec Still works... 2025-08-13 22:25:01 +02:00
7ade8ef1c8 Merge branch 'experimental/cleanup' 2025-08-13 21:02:21 +02:00
28 changed files with 475 additions and 557 deletions

84
deprecated/reste.cpp Normal file
View File

@@ -0,0 +1,84 @@
XQItem* createTreeEntry( XQNodePtr contentNode );
//! erzeugt einen eintrag in der baum-übersicht.
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
{
/*
for(const auto& section : _sections )
{
qDebug() << " --- wtf1: " << contentNode->to_string();
qDebug() << " --- wtf2: " << section.sheetRootNode->to_string();
if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") )
{
//XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode );
makeTreeChildItem:
// den itemtype des neuen items rausfinden
QString typeKey = sheetEntry->attribute("ItemType");
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
//XQItemType* itemType = makeItemType(sheetEntry); // throws
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
XQItem* newItem = new XQItem( itemType, contentPtr );
return newItem;
section.headerItem().appendRow( newTreeentry );
_treeTable->expand( section.modelIndex );
// ??
_treeTable->setCurrentIndex( section.modelIndex );
newTreeentry->setContentNode(contentNode);
emit xqItemCreated( newTreeentry );
return newTreeentry;
}
}
*/
throw XQException( "createTreeEntry: main model should not be empty!" );
}
<Section ContentType="Inverter">
<Header Marker="Inverter">
<InverterID Caption="Inverter" ItemType="HeaderType" />
<InverterName Caption="Name" ItemType="HeaderType" />
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
<MaxPowerInput Caption="max. Input" ItemType="HeaderType" />
<MaxPowerOutput Caption="max Output" ItemType="HeaderType" />
<NumStrings Caption="Strings" ItemType="HeaderType" />
<Weight Caption="Weight" ItemType="HeaderType" />
</Header>
<Data>
<InverterID Caption="Inverter" ItemType="ValueType" />
<InverterName Caption="Name" ItemType="ValueType" />
<Manufacturer Caption="Manufacturer" ItemType="ValueType" />
<MaxPowerInput Caption="max. Input" ItemType="ValueType" ItemType="ChoiceType" ChoiceDataSource="MaxPowerInputChoice" UnitType="W"/>
<MaxPowerOutput Caption="max Output" ItemType="ValueType" UnitType="W"/>
<NumStrings Caption="Strings" ItemType="ValueType" />
<Weight Caption="Weight" ItemType="ValueType" UnitType="kg"/>
</Data>
</Section>
<Section ContentType="Battery">
<Header Marker="Battery">
<BatteryID Caption="Name" ItemType="HeaderType" />
<BatteryName Caption="Battery" ItemType="HeaderType" />
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
<Capacity Caption="Capacity" ItemType="HeaderType"/>
<Yield Caption="Yield" ItemType="HeaderType" />
<MaxCurrent Caption="max. Current" ItemType="HeaderType" />
<MaxVolt Caption="max. Volt" ItemType="HeaderType" />
</Header>
<Data>
<BatteryID Caption="Battery" ItemType="ValueType" />
<BatteryName Caption="Name" ItemType="ValueType" />
<Manufacturer Caption="Manufacturer" ItemType="ValueType" />
<Capacity Caption="Capacity" ItemType="ValueType" UnitType="Wh"/>
<Yield Caption="Yield" ItemType="ValueType" ItemType="PercentageType" UnitType="%"/>
<MaxCurrent Caption="max. Current" ItemType="ValueType" UnitType="A"/>
<MaxVolt Caption="max. Volt" ItemType="ValueType" UnitType="V"/>
</Data>
</Section>

29
deprecated/xqicon.cpp Normal file
View File

@@ -0,0 +1,29 @@
/***************************************************************************
source::worx xtree
Copyright © 2024-2025 c.holzheuer
christoph.holzheuer@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#include <xqicon.h>
XQIcon::XQIcon()
{}
XQIcon::XQIcon( const QIcon& icon, const QString& iconKey )
: QIcon{icon}, _iconKey{iconKey}
{
}
const QString& XQIcon::iconKey()
{
return _iconKey;
}

35
deprecated/xqicon.h Normal file
View File

@@ -0,0 +1,35 @@
/***************************************************************************
source::worx xtree
Copyright © 2024-2025 c.holzheuer
christoph.holzheuer@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#ifndef XQICON_H
#define XQICON_H
#include <QIcon>
class XQIcon : public QIcon
{
public:
XQIcon();
XQIcon( const QIcon& icon, const QString& iconKey );
const QString& iconKey();
protected:
QString _iconKey;
};
#endif // XQICON_H

View File

@@ -36,89 +36,91 @@ namespace XQAppData
{ {
public: public:
XQAppIconMap() = default; XQAppIconMap()
{
}
void init() void init()
{ {
insert( "DirIcon" , QApplication::style()->standardIcon(QStyle::SP_DirIcon)); namedInsert( "DirIcon" , QStyle::SP_DirIcon );
insert( "FileDialogBack", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack)); namedInsert( "FileDialogBack", QStyle::SP_FileDialogBack );
insert( "FileDialogContentsView", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView)); namedInsert( "FileDialogContentsView", QStyle::SP_FileDialogContentsView );
insert( "FileDialogDetailedView", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView)); namedInsert( "FileDialogDetailedView", QStyle::SP_FileDialogDetailedView );
insert( "icn05Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd)); namedInsert( "icn05Dummy", QStyle::SP_FileDialogEnd );
insert( "icn06Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView)); namedInsert( "icn06Dummy", QStyle::SP_FileDialogInfoView );
insert( "icn07Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView)); namedInsert( "icn07Dummy", QStyle::SP_FileDialogListView );
insert( "icn08Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder)); namedInsert( "icn08Dummy", QStyle::SP_FileDialogNewFolder );
insert( "icn09Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart)); namedInsert( "icn09Dummy", QStyle::SP_FileDialogStart );
insert( "icn10Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent)); namedInsert( "icn10Dummy", QStyle::SP_FileDialogToParent );
insert( "icn11Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowBack)); namedInsert( "icn11Dummy", QStyle::SP_ArrowBack );
insert( "icn12Dummy", QApplication::style()->standardIcon(QStyle::SP_DirIcon)); namedInsert( "icn12Dummy", QStyle::SP_DirIcon );
insert( "icn13Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipBackward)); namedInsert( "icn13Dummy", QStyle::SP_MediaSkipBackward );
insert( "icn14Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowDown)); namedInsert( "icn14Dummy", QStyle::SP_ArrowDown );
insert( "icn15Dummy", QApplication::style()->standardIcon(QStyle::SP_DirLinkIcon)); namedInsert( "icn15Dummy", QStyle::SP_DirLinkIcon );
insert( "icn16Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipForward)); namedInsert( "icn16Dummy", QStyle::SP_MediaSkipForward );
insert( "icn17Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowForward)); namedInsert( "icn17Dummy", QStyle::SP_ArrowForward );
insert( "icn18Dummy", QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)); namedInsert( "icn18Dummy", QStyle::SP_DirOpenIcon );
insert( "icn19Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaStop)); namedInsert( "icn19Dummy", QStyle::SP_MediaStop );
insert( "icn20Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowLeft)); namedInsert( "icn20Dummy", QStyle::SP_ArrowLeft );
insert( "icn21Dummy", QApplication::style()->standardIcon(QStyle::SP_DockWidgetCloseButton)); namedInsert( "icn21Dummy", QStyle::SP_DockWidgetCloseButton );
insert( "icn22Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolume)); namedInsert( "icn22Dummy", QStyle::SP_MediaVolume );
insert( "icn23Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowRight)); namedInsert( "icn23Dummy", QStyle::SP_ArrowRight );
insert( "icn24Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon)); namedInsert( "icn24Dummy", QStyle::SP_DriveCDIcon );
insert( "icn25Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolumeMuted)); namedInsert( "icn25Dummy", QStyle::SP_MediaVolumeMuted );
insert( "icn26Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowUp)); namedInsert( "icn26Dummy", QStyle::SP_ArrowUp );
insert( "icn27Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveDVDIcon)); namedInsert( "icn27Dummy", QStyle::SP_DriveDVDIcon );
insert( "icn28Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical)); namedInsert( "icn28Dummy", QStyle::SP_MessageBoxCritical );
insert( "icn29Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserReload)); namedInsert( "icn29Dummy", QStyle::SP_BrowserReload );
insert( "icn30Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveFDIcon)); namedInsert( "icn30Dummy", QStyle::SP_DriveFDIcon );
insert( "icn31Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)); namedInsert( "icn31Dummy", QStyle::SP_MessageBoxInformation );
insert( "icn32Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserStop)); namedInsert( "BrowserStop", QStyle::SP_BrowserStop );
insert( "icn33Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveHDIcon)); namedInsert( "icn33Dummy", QStyle::SP_DriveHDIcon );
insert( "icn34Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion)); namedInsert( "icn34Dummy", QStyle::SP_MessageBoxQuestion );
insert( "icn35Dummy", QApplication::style()->standardIcon(QStyle::SP_CommandLink)); namedInsert( "icn35Dummy", QStyle::SP_CommandLink );
insert( "icn36Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveNetIcon)); namedInsert( "icn36Dummy", QStyle::SP_DriveNetIcon );
insert( "icn37Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning)); namedInsert( "icn37Dummy", QStyle::SP_MessageBoxWarning );
insert( "icn38Dummy", QApplication::style()->standardIcon(QStyle::SP_ComputerIcon)); namedInsert( "icn38Dummy", QStyle::SP_ComputerIcon );
insert( "icn39Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack)); namedInsert( "icn39Dummy", QStyle::SP_FileDialogBack );
insert( "icn40Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton)); namedInsert( "icn40Dummy", QStyle::SP_TitleBarCloseButton );
insert( "icn41Dummy", QApplication::style()->standardIcon(QStyle::SP_CustomBase)); namedInsert( "icn42Dummy", QStyle::SP_FileDialogContentsView );
insert( "icn42Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView)); namedInsert( "icn43Dummy", QStyle::SP_TitleBarContextHelpButton );
insert( "icn43Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarContextHelpButton)); namedInsert( "DesktopIcon", QStyle::SP_DesktopIcon );
insert( "icn44Dummy", QApplication::style()->standardIcon(QStyle::SP_DesktopIcon)); namedInsert( "icn45Dummy", QStyle::SP_FileDialogDetailedView );
insert( "icn45Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView)); namedInsert( "icn46Dummy", QStyle::SP_TitleBarMaxButton );
insert( "icn46Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton)); namedInsert( "icn47Dummy", QStyle::SP_DialogApplyButton );
insert( "icn47Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton)); namedInsert( "icn48Dummy", QStyle::SP_FileDialogEnd );
insert( "icn48Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd)); namedInsert( "icn49Dummy", QStyle::SP_TitleBarMenuButton );
insert( "icn49Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton)); namedInsert( "icn50Dummy", QStyle::SP_DialogCancelButton );
insert( "icn50Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); namedInsert( "icn51Dummy", QStyle::SP_FileDialogInfoView );
insert( "icn51Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView)); namedInsert( "icn52Dummy", QStyle::SP_TitleBarMinButton );
insert( "icn52Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMinButton)); namedInsert( "icn53Dummy", QStyle::SP_DialogCloseButton );
insert( "icn53Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton)); namedInsert( "icn54Dummy", QStyle::SP_FileDialogListView );
insert( "icn54Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView)); namedInsert( "icn55Dummy", QStyle::SP_TitleBarNormalButton );
insert( "icn55Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarNormalButton)); namedInsert( "icn56Dummy", QStyle::SP_DialogDiscardButton );
insert( "icn56Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogDiscardButton)); namedInsert( "icn57Dummy", QStyle::SP_FileDialogNewFolder );
insert( "icn57Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder)); namedInsert( "icn58Dummy", QStyle::SP_TitleBarShadeButton );
insert( "icn58Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarShadeButton)); namedInsert( "icn59Dummy", QStyle::SP_DialogHelpButton );
insert( "icn59Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogHelpButton)); namedInsert( "icn60Dummy", QStyle::SP_FileDialogStart );
insert( "icn60Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart)); namedInsert( "icn61Dummy", QStyle::SP_TitleBarUnshadeButton );
insert( "icn61Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarUnshadeButton)); namedInsert( "icn62Dummy", QStyle::SP_DialogNoButton );
insert( "icn62Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogNoButton)); namedInsert( "icn63Dummy", QStyle::SP_FileDialogToParent );
insert( "icn63Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent)); namedInsert( "icn64Dummy", QStyle::SP_ToolBarHorizontalExtensionButton );
insert( "icn64Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton)); namedInsert( "icn65Dummy", QStyle::SP_DialogOkButton );
insert( "icn65Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); namedInsert( "FileIcon", QStyle::SP_FileIcon );
insert( "FileIcon", QApplication::style()->standardIcon(QStyle::SP_FileIcon)); namedInsert( "icn67Dummy", QStyle::SP_ToolBarVerticalExtensionButton );
insert( "icn67Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton)); namedInsert( "icn68Dummy", QStyle::SP_DialogResetButton );
insert( "icn68Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogResetButton)); namedInsert( "icn70Dummy", QStyle::SP_FileLinkIcon );
insert( "icn70Dummy", QApplication::style()->standardIcon(QStyle::SP_FileLinkIcon)); namedInsert( "TrashIcon", QStyle::SP_TrashIcon );
insert( "TrashIcon", QApplication::style()->standardIcon(QStyle::SP_TrashIcon)); namedInsert( "icn72Dummy", QStyle::SP_DialogSaveButton );
insert( "icn72Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton)); namedInsert( "icn73Dummy", QStyle::SP_MediaPause );
insert( "icn73Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPause)); namedInsert( "icn74Dummy", QStyle::SP_VistaShield );
insert( "icn74Dummy", QApplication::style()->standardIcon(QStyle::SP_VistaShield)); namedInsert( "icn75Dummy", QStyle::SP_DialogYesButton );
insert( "icn75Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogYesButton)); namedInsert( "icn76Dummy", QStyle::SP_MediaPlay );
insert( "icn76Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPlay)); namedInsert( "icn77Dummy", QStyle::SP_DirClosedIcon );
insert( "icn77Dummy", QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon)); namedInsert( "icn79Dummy", QStyle::SP_MediaSeekBackward );
insert( "icn79Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward)); namedInsert( "DirHomeIcon", QStyle::SP_DirHomeIcon );
insert( "DirHomeIcon", QApplication::style()->standardIcon(QStyle::SP_DirHomeIcon)); namedInsert( "icn81Dummy", QStyle::SP_MediaSeekForward );
insert( "icn81Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward));
/* /*
auto from = to_underlying(QIcon::ThemeIcon::AddressBookNew); auto from = to_underlying(QIcon::ThemeIcon::AddressBookNew);
auto to = to_underlying(QIcon::ThemeIcon::NThemeIcons); auto to = to_underlying(QIcon::ThemeIcon::NThemeIcons);
@@ -134,8 +136,22 @@ namespace XQAppData
} }
}; void namedInsert( const QString& key, QStyle::StandardPixmap pixmapID )
{
QIcon icon = QApplication::style()->standardIcon( pixmapID );
insert( key, icon );
_keysToNames.insert( icon.cacheKey(), key );
}
QString iconName( const QIcon& icon )
{
return _keysToNames[icon.cacheKey()];
}
protected:
QMap<qint64,QString> _keysToNames;
};
@@ -150,102 +166,24 @@ namespace XQAppData
static XQAppIconMap s_IconMap; static XQAppIconMap s_IconMap;
bool hasTypeIcon(const QString& key )
{
if(s_IconMap.isEmpty())
s_IconMap.init();
return !key.isEmpty() && s_IconMap.contains(key);
}
QIcon typeIcon(const QString& key ) QIcon typeIcon(const QString& key )
{ {
if( hasTypeIcon(key) ) if(s_IconMap.isEmpty())
s_IconMap.init();
if( s_IconMap.contains(key) )
return s_IconMap[key]; return s_IconMap[key];
return QApplication::style()->standardIcon(QStyle::SP_TrashIcon);
return QApplication::style()->standardIcon( QStyle::SP_TrashIcon);
} }
QString iconName( const QIcon& icon )
/* {
{ "icnFolder" , QApplication::style()->standardIcon(QStyle::SP_DirIcon) }, if(s_IconMap.isEmpty())
{ "icnFolder" , QApplication::style()->standardIcon(QStyle::SP_DirIcon"); s_IconMap.init();
{ "icn02Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack"); return s_IconMap.iconName(icon);
{ "icn03Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView");
{ "icn04Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView");
{ "icn05Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd");
{ "icn06Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView");
{ "icn07Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView");
{ "icn08Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder");
{ "icn09Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart");
{ "icn10Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent");
{ "icn11Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowBack");
{ "icn12Dummy", QApplication::style()->standardIcon(QStyle::SP_DirIcon");
{ "icn13Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipBackward");
{ "icn14Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowDown");
{ "icn15Dummy", QApplication::style()->standardIcon(QStyle::SP_DirLinkIcon");
{ "icn16Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipForward");
{ "icn17Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowForward");
{ "icn18Dummy", QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon");
{ "icn19Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaStop");
{ "icn20Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowLeft");
{ "icn21Dummy", QApplication::style()->standardIcon(QStyle::SP_DockWidgetCloseButton");
{ "icn22Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolume");
{ "icn23Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowRight");
{ "icn24Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon");
{ "icn25Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolumeMuted");
{ "icn26Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowUp");
{ "icn27Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveDVDIcon");
{ "icn28Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical");
{ "icn29Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserReload");
{ "icn30Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveFDIcon");
{ "icn31Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation");
{ "icn32Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserStop");
{ "icn33Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveHDIcon");
{ "icn34Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion");
{ "icn35Dummy", QApplication::style()->standardIcon(QStyle::SP_CommandLink");
{ "icn36Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveNetIcon");
{ "icn37Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning");
{ "icn38Dummy", QApplication::style()->standardIcon(QStyle::SP_ComputerIcon");
{ "icn39Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack");
{ "icn40Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton");
{ "icn41Dummy", QApplication::style()->standardIcon(QStyle::SP_CustomBase");
{ "icn42Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView");
{ "icn43Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarContextHelpButton");
{ "icn44Dummy", QApplication::style()->standardIcon(QStyle::SP_DesktopIcon");
{ "icn45Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView");
{ "icn46Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton");
{ "icn47Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton");
{ "icn48Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd");
{ "icn49Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton");
{ "icn50Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton");
{ "icn51Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView");
{ "icn52Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMinButton");
{ "icn53Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton");
{ "icn54Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView");
{ "icn55Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarNormalButton");
{ "icn56Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogDiscardButton");
{ "icn57Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder");
{ "icn58Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarShadeButton");
{ "icn59Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogHelpButton");
{ "icn60Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart");
{ "icn61Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarUnshadeButton");
{ "icn62Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogNoButton");
{ "icn63Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent");
{ "icn64Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton");
{ "icn65Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogOkButton");
{ "icn66Dummy", QApplication::style()->standardIcon(QStyle::SP_FileIcon");
{ "icn67Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton");
{ "icn68Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogResetButton");
{ "icn70Dummy", QApplication::style()->standardIcon(QStyle::SP_FileLinkIcon");
{ "icn71Dummy", QApplication::style()->standardIcon(QStyle::SP_TrashIcon");
{ "icn72Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton");
{ "icn73Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPause");
{ "icn74Dummy", QApplication::style()->standardIcon(QStyle::SP_VistaShield");
{ "icn75Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogYesButton");
{ "icn76Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPlay");
{ "icn77Dummy", QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon");
{ "icn79Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward");
{ "icn80Dummy", QApplication::style()->standardIcon(QStyle::SP_DirHomeIcon");
{ "icn81Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward)}
} }
*/
}; // namespace XQAppData }; // namespace XQAppData

View File

@@ -20,6 +20,7 @@
#include <QMap> #include <QMap>
#include <QStringView> #include <QStringView>
#include <QIcon> #include <QIcon>
#include <pugixml.hpp> #include <pugixml.hpp>
const QString c_Version = "0.1.1 04.09.2024"; const QString c_Version = "0.1.1 04.09.2024";
@@ -27,6 +28,8 @@ 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_Data = "Data";
const QString c_MainModelName = "DocumentTreeModel"; const QString c_MainModelName = "DocumentTreeModel";
const QString c_ChildModelName = "DocumentDetailsModel"; const QString c_ChildModelName = "DocumentDetailsModel";
@@ -46,8 +49,8 @@ namespace XQAppData
{ {
//class XQAppIconMap; //class XQAppIconMap;
bool hasTypeIcon(const QString& key );
QIcon typeIcon(const QString& key ); QIcon typeIcon(const QString& key );
QString iconName( const QIcon& icon );
} }
#endif // XQAPPDATA_H #endif // XQAPPDATA_H

View File

@@ -31,72 +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 )
{ {
@@ -127,8 +62,8 @@ 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 );
// als Baum? // als Baum?
//section.headerItem().appendRow( list ); //section.headerItem().appendRow( list );
insertRow( newRow, list); insertRow( newRow, list);

View File

@@ -29,13 +29,10 @@ public:
explicit XQChildModel(QObject *parent = nullptr); explicit XQChildModel(QObject *parent = nullptr);
virtual ~XQChildModel() = default; virtual ~XQChildModel() = default;
void initModel(const QString& modelName) override;
void setContent(const XQNodePtr& contentRoot ); void setContent(const XQNodePtr& contentRoot );
protected: protected:
//void setupViewProperties() override; //void setupViewProperties() override;
void initContextMenu() override; void initContextMenu() override;

View File

@@ -34,54 +34,6 @@ XQMainModel::XQMainModel(QObject *parent )
} }
//! initialisiert dieses model über den namen.
void XQMainModel::initModel(const QString& modelName)
{
// model rootnode finden -> <DocumentTreeModel>
XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws
// #1: über alle sections
for( auto& section : modelSheet->children() )
{
// #2: (optionalen) header erzeugen
const XQNodePtr header = section->find_child_by_tag_name( "Header");
if( header )
{
XQItemList list = _itemFactory.makeHeader( header );
Q_ASSERT(!list.isEmpty());
addSection(list, section );
}
}
}
//! erzeugt einen eintrag in der baum-übersicht.
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
{
for(const auto& section : _sections )
{
qDebug() << " --- wtf1: " << contentNode->to_string();
qDebug() << " --- wtf2: " << section.sheetRootNode->to_string();
if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") )
{
XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode );
section.headerItem().appendRow( newTreeentry );
_treeTable->expand( section.modelIndex );
// ??
_treeTable->setCurrentIndex( section.modelIndex );
newTreeentry->setContentNode(contentNode);
emit xqItemCreated( newTreeentry );
return newTreeentry;
}
}
throw XQException( "createTreeEntry: main model should not be emtpy!" );
}
//! leere default implementation //! leere default implementation
void XQMainModel::initContextMenu() void XQMainModel::initContextMenu()

View File

@@ -32,8 +32,7 @@ public:
explicit XQMainModel(QObject *parent = nullptr); explicit XQMainModel(QObject *parent = nullptr);
virtual ~XQMainModel() = default; virtual ~XQMainModel() = default;
void initModel(const QString& modelName) override;
XQItem* createTreeEntry( XQNodePtr contentNode );
public slots: public slots:

View File

@@ -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 );
*/
} }

View File

@@ -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 );

View File

@@ -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 );
} }
}; };
@@ -68,28 +68,32 @@ bool XQItemFactory::isValid()
} }
//! es reicht nicht, einen itemType aus den itemType-templates zu //! Es reicht nicht, einen itemType aus den itemType-templates zu
//! holen: möglicherweise muss der noch mit zusätzlichen attributen //! holen: möglicherweise muss der noch mit zusätzlichen attributen
//! ergänzt werden, (hier 'UnitType' ). //! ergänzt werden.
//! Vom aufwand ist es auch egal, ob ich daten aus dem XML in das
//! item oder den itemtyp schreiben muss.
XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry ) XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry )
{ {
QString typeKey = sheetEntry->attribute("ItemType"); QString typeKey = sheetEntry->attribute( c_ItemType );
XQItemType* itemType = findItemTypeTemplate(typeKey); XQItemType* itemType = findItemTypeTemplate(typeKey);
// wir prüfen, ob im sheetEntry noch zusätzliche attribute vorhanden // wir prüfen, ob im sheetEntry noch zusätzliche attribute vorhanden
// sind, die wir in dem itemType müssen // sind, die wir in dem itemType müssen
qDebug() << " --- makeItemType: " << sheetEntry->to_string();
// über alle attribute // über alle attribute
for (const auto& attr : sheetEntry->attributes()) for (const auto& attrEntry : sheetEntry->attributes())
{ {
// prüfen, ob der itemType des attribute schon hat // prüfen, ob der itemType des attribute schon hat
int role = itemType->hasAttribute( attr.first); int role = itemType->roleForAttributeKey( attrEntry.first );
// wenn ja, überschreiben // wenn ja, überschreiben
if( role != XQItem::NoRole ) if( role != XQItem::NoRole )
{ {
QVariant newValue = makeVariant(role,attr.second); QVariant newValue = makeVariant(role, attrEntry.second );
itemType = itemType->replaceAttribute( newValue, role ); itemType = itemType->replaceAttribute( newValue, role );
} }
@@ -97,6 +101,8 @@ XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry )
return itemType; return itemType;
} }
//! sucht einen item typ aus der map mit 'vorgefertigen' itemtypen.
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 +111,8 @@ XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const
} }
//! sucht eine model-beschreibung
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,40 +123,7 @@ XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const
} }
//! erzeugt eine QVariant aus dem gegebenen string und setzt diese dann via role im item.
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 )
{
// den itemtype des neuen items rausfinden
QString typeKey = sheetEntry->attribute("ItemType");
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
//XQItemType* itemType = makeItemType(sheetEntry); // throws
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
XQItem* newItem = new XQItem( itemType, contentPtr );
return newItem;
}
void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const
{ {
@@ -162,6 +137,8 @@ void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey,
} }
//! erzeugt eine QVariant aus dem gegebenen string
QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
{ {
@@ -180,6 +157,7 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
case XQItem::ItemTypeRole: case XQItem::ItemTypeRole:
{ {
// itemType() -> XQItemType* // itemType() -> XQItemType*
qDebug() << " --- makeVariant: make ItemType: " << source;
XQItemType* itemType = findItemTypeTemplate( source ); XQItemType* itemType = findItemTypeTemplate( source );
value = QVariant::fromValue(itemType); value = QVariant::fromValue(itemType);
break; break;
@@ -230,9 +208,7 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
case XQItem::IconRole: case XQItem::IconRole:
{ {
QIcon typeIcon; QIcon typeIcon = XQAppData::typeIcon(source);
if(XQAppData::hasTypeIcon(source))
typeIcon = XQAppData::typeIcon(source);
value = QVariant::fromValue(typeIcon); value = QVariant::fromValue(typeIcon);
break; break;
} }
@@ -283,25 +259,16 @@ 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);
//XQItemType* itemType = makeItemType(sheetEntry); // throws
XQItemType* itemType = findItemTypeTemplate(typeKey); XQItemType* itemType = makeItemType(sheetNode); // throws
// fallunterscheidung beim inhalt: // fallunterscheidung beim inhalt:
const QString* contentPtr{}; const QString* contentPtr{};
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung // das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
@@ -315,53 +282,10 @@ XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNo
} }
XQItemList XQItemFactory::makeHeader( const XQNodePtr& headerNode )
{
XQItemList list; //! erzeugt eine item-row.
for( const auto& headerEntry : headerNode->children() ) XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
{
qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption");
XQItem* headerItem = makeItem( headerEntry );
list.append( headerItem );
}
return list;
}
XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& sheetNode )
{
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 );
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 +302,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 +316,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 +333,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 +355,4 @@ XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const
return makeContentRow(contentNode, sheetNode ); return makeContentRow(contentNode, sheetNode );
} }
*/

View File

@@ -32,20 +32,14 @@ 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* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr); XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr);
XQItemList makeHeader( const XQNodePtr& sheetNode );
XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
//XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
XQItemList makeHeaderRow( const XQNodePtr& sheetNode );
XQItemList makeContentRow( 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;

View File

@@ -65,23 +65,22 @@ 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);
} }
//! tested, ob ein attribute (z.B. unitType) hier vorhanden ist //! tested, ob ein attribute (z.B. unitType) hier vorhanden ist
int XQItemType::hasAttribute( const QString& attrKey ) int XQItemType::roleForAttributeKey( const QString& attrKey )
{ {
int role = XQItem::fetchItemDataRole(attrKey); int role = XQItem::fetchItemDataRole(attrKey);
// gibbed überhaupt eine rolle für unser attribut? // gibbed überhaupt eine rolle für unser attribut?
if( role == XQItem::NoRole) if( role != XQItem::NoRole)
return XQItem::NoRole; {
// wenn ja, ist die role hier besetzt? // wenn ja, ist die role hier besetzt?
QVariant value = data(role); QVariant value = data(role);
if( !value.isValid() || value.isNull() ) if( !value.isValid() || value.isNull() )
return XQItem::NoRole; return XQItem::NoRole;
}
return role; return role;
} }
@@ -91,6 +90,15 @@ int XQItemType::hasAttribute( const QString& attrKey )
XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role ) XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role )
{ {
QString msg = newValue.toString();
if( role == XQItem::IconRole )
{
QIcon icn = newValue.value<QIcon>();
msg = XQAppData::iconName( icn );
}
qDebug() << " --- Before: " << makeItemTypeKey() << " role:" << XQItem::fetchItemDataRoleName(role) << " value:" << msg;
// hat sich überhaupt was geändert? // hat sich überhaupt was geändert?
QVariant oldValue = data(role); QVariant oldValue = data(role);
@@ -115,8 +123,10 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role )
// speichern // speichern
s_ItemTypeMap.insert( newKey, myClone ); s_ItemTypeMap.insert( newKey, myClone );
// und ins item übernehmen
//item.setItemType( myClone );
qDebug() << " --- After: " << myClone->makeItemTypeKey();
/// Obacht! Der alte, geänderte itemType bleibt erhalten /// Obacht! Der alte, geänderte itemType bleibt erhalten
/// und verrottet ggf. ohne Daseinszweck /// und verrottet ggf. ohne Daseinszweck
@@ -131,6 +141,7 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role )
QVariant XQItemType::formatText( const XQItem& item ) const QVariant XQItemType::formatText( const XQItem& item ) const
{ {
XQItem::UnitType uType = unitType(); XQItem::UnitType uType = unitType();
//qDebug() << " --- formatText: " << XQItem::fetchUnitTypeToString( uType);
const QString& cont = item.content(); const QString& cont = item.content();
if( uType != XQItem::NoUnitType ) if( uType != XQItem::NoUnitType )
return formatToSI( cont, uType ); return formatToSI( cont, uType );
@@ -245,9 +256,11 @@ QString XQItemType::makeItemTypeKey()
key = key.arg( editorTypeToString() ); key = key.arg( editorTypeToString() );
key = key.arg( unitTypeToString() ); key = key.arg( unitTypeToString() );
key = key.arg( contentFormat() ); key = key.arg( contentFormat() );
key = key.arg( data(XQItem::FlagsRole).toString() ); key = key.arg( data(XQItem::FlagsRole).toString() );
key = key.arg( icon().name() ); // icons haben leider keine namen, es sei denn, sie kommen aus einen theme
//key = key.arg( icon().name() );
//key = key.arg( icon().cacheKey() );
key = key.arg( XQAppData::iconName( icon() ) );
key = key.arg( fixedChoicesToString() ); key = key.arg( fixedChoicesToString() );
return key; return key;

View File

@@ -40,12 +40,12 @@ public:
QVariant data( int role ) const override; QVariant data( int role ) const override;
void setData(const QVariant& value, int role ) override; void setData(const QVariant& value, int role ) override;
virtual QVariant formatText( const XQItem& item ) const; QVariant formatText( const XQItem& item ) const;
QString formatToSI(const QString& rawText, XQItem::UnitType unitType ) const; QString formatToSI(const QString& rawText, XQItem::UnitType unitType ) const;
QString unFormatFromSI(const QString& valueText ) const; QString unFormatFromSI(const QString& valueText ) const;
int hasAttribute( const QString& attrKey ); int roleForAttributeKey( const QString& attrKey );
XQItemType* replaceAttribute(const QVariant& newValue, int role ); XQItemType* replaceAttribute(const QVariant& newValue, int role );
QString makeItemTypeKey(); QString makeItemTypeKey();

View File

@@ -14,6 +14,7 @@
#include <QDebug> #include <QDebug>
#include <QApplication> #include <QApplication>
#include <QMetaType>
#include <xqmainwindow.h> #include <xqmainwindow.h>
@@ -48,12 +49,13 @@ who is who:
*/ */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
QIcon icon;
//app.setStyle("fusion"); //app.setStyle("fusion");
XQMainWindow window; XQMainWindow window;
window.show(); window.show();

View File

@@ -13,7 +13,7 @@
#include <xqmodelsectionlist.h> #include <xqmodelsectionlist.h>
#include <xqitem.h>
//! kontstruktor. übergibt den start-index und einen model-knoten mit der beschreibung //! kontstruktor. übergibt den start-index und einen model-knoten mit der beschreibung
@@ -57,13 +57,7 @@ XQItem& XQModelSection::XQModelSection::headerItem() const
return XQItem::xqItemFromIndex( modelIndex ); return XQItem::xqItemFromIndex( modelIndex );
} }
//! testet, ob die unter 'sectionKey' eine gültige section vorhanden ist.
void XQModelSectionList::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode)
{
XQModelSection section(idx, sheetNode);
addAtKey(sheetNode->tag_name(), section);
}
bool XQModelSectionList::hasValidSection(const QString& sectionKey) const bool XQModelSectionList::hasValidSection(const QString& sectionKey) const
{ {
@@ -72,13 +66,17 @@ bool XQModelSectionList::hasValidSection(const QString& sectionKey) const
return at(sectionKey).isValid(); return at(sectionKey).isValid();
} }
//! gibt für einen model index die 'zuständige' section zurück.
const XQModelSection& XQModelSectionList::sectionxqItemFromIndex( const QModelIndex& index ) const const XQModelSection& XQModelSectionList::sectionFromIndex( const QModelIndex& index ) const
{ {
return sectionFromRow( index.row() ); return sectionFromRow( index.row() );
} }
//! gibt für eine zeile die 'zuständige' section zurück: der bestand an section wird
//! nach der passenden section durchsucht.
const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const
{ {
@@ -95,18 +93,26 @@ const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const
} }
//! ermittelt die erste zeile einer section.
int XQModelSectionList::firstRow(const QModelIndex& idx) const int XQModelSectionList::firstRow(const QModelIndex& idx) const
{ {
return sectionFromRow(idx.row() ).row(); return sectionFromRow(idx.row() ).row();
} }
//! ermittelt die zeile unterhalb des gegebenen modelindex,
//! zum einfügen neuer items ebendort.
int XQModelSectionList::lastRow(const QModelIndex& idx) const int XQModelSectionList::lastRow(const QModelIndex& idx) const
{ {
return lastRow(sectionFromRow(idx.row())); return lastRow(sectionFromRow(idx.row()));
} }
//! ermittelt die zeile unterhalb der gegebenen section,
//! zum einfügen neuer items ebendort.
int XQModelSectionList::lastRow(const XQModelSection& section ) const int XQModelSectionList::lastRow(const XQModelSection& section ) const
{ {
//qDebug() << " -- last row in section: " << section.modelIndex.data().toString() << " --> " << section.modelIndex.row(); //qDebug() << " -- last row in section: " << section.modelIndex.data().toString() << " --> " << section.modelIndex.row();
@@ -125,6 +131,8 @@ int XQModelSectionList::lastRow(const XQModelSection& section ) const
} }
//! gibt alle sections aus, zum ankucken.
void XQModelSectionList::dump() const void XQModelSectionList::dump() const
{ {
qDebug() << " --- sections dump(): " <<size() << " entries."; qDebug() << " --- sections dump(): " <<size() << " entries.";

View File

@@ -16,10 +16,9 @@
#define XQMODELSECTIONLIST_H #define XQMODELSECTIONLIST_H
#include <QPersistentModelIndex> #include <QPersistentModelIndex>
#include <xqnode.h>
#include <xqmaptor.h>
class XQItem; #include <xqmaptor.h>
#include <xqitem.h>
/** /**
* @brief Struct containing data for a header section * @brief Struct containing data for a header section
@@ -54,11 +53,11 @@ public:
XQModelSectionList() = default; XQModelSectionList() = default;
virtual ~XQModelSectionList() = default; virtual ~XQModelSectionList() = default;
void addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode ); void createSectionEntry(const XQItemList& list, const XQNodePtr& sheetNode );
bool hasValidSection(const QString& sectionKey) const; bool hasValidSection(const QString& sectionKey) const;
const XQModelSection& sectionFromRow( int row ) const; const XQModelSection& sectionFromRow( int row ) const;
const XQModelSection& sectionxqItemFromIndex( const QModelIndex& index ) const; const XQModelSection& sectionFromIndex( const QModelIndex& index ) const;
int firstRow(const QModelIndex& idx) const; int firstRow(const QModelIndex& idx) const;
int lastRow(const QModelIndex& idx) const; int lastRow(const QModelIndex& idx) const;

View File

@@ -83,57 +83,65 @@ XQItem& XQViewModel::xqFirstItem(int row) const
return *static_cast<XQItem*>( QStandardItemModel::item(row) ); return *static_cast<XQItem*>( QStandardItemModel::item(row) );
} }
//! create the own model structure
void XQViewModel::initModel( const QString& modelName) //! initialisiert dieses model über den namen. Es wird hier
//! nur die strukur erzeugt, keine inhalte.
void XQViewModel::initModel(const QString& modelName)
{ {
/* /*
model model
section section
header header
data
section section
... ...
*/ */
// model rootnode finden -> <DocumentTreeModel>
/*
// #0: Wir suchen die Model-Beschreibung
XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws
// #1: Wir erzeugen die Model-Struktur: Jedes Kind beschreibt einen // #1: über alle sections
// XML-Datentyp, z.B. <Panel atr1="..." />, <Battery .../> for( auto& section : modelSheet->children() )
// Jeder XML-Knoten entspricht einer Zeile im späteren Model, jedes
// Attribut wird einem eigenen Feld (XQItem) abgebildet.
for( const auto& sheetNode : modelSheet->children() )
{ {
// #2: (optionalen?) header erzeugen
const XQNodePtr header = section->find_child_by_tag_name( "Header");
XQItemList list = _itemFactory.makeHeaderRow( sheetNode ); if( header )
// 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(); XQItemList list = _itemFactory.makeContentRow( header, nullptr );
extendItemType( sheetChild ); addSection(list, section );
} }
}
}
// empty row: //! hilfsfunktion: fügt die liste unserem model hinzu und erzeugt eine 'section'.
//XQNodePtr contentNode = XQNode::make_node( sheetNode->tag_name() ); //! die section kann erst gültig sein, wenn die items im model gelandet sind,
//XQItemList emptyRow = _itemFactory.makeEmptyRow( contentNode, sheetNode ); //! deswegen ist das hier zusammengefasst.
//appendRow( emptyRow );
//! erzeugt dann eine section aus einer frisch erzeugten itemlist. der erste modelindex
//! der liste und der unterknoten 'Data' werden gespeichert.
} // for void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode )
*/ {
// 1. die liste darf nicht leer sein
Q_ASSERT(!list.isEmpty());
// 2. sheetNode muss da sein
Q_ASSERT(sheetNode);
// 3. 'ContenType' muss vorhanden sein
if( !sheetNode->has_attribute( c_ContentType) )
throw XQException( "section list: Section node needs attribute 'ContentType'!");
// 4. Data child muss auch da sein
XQNodePtr dataNode = sheetNode->find_child_by_tag_name( c_Data );
if( !dataNode )
throw XQException( "section list: 'Data' child is missing!");
// 5. das erzeugt dann auch valide indices
appendRow(list);
XQModelSection section(list[0]->index(), dataNode );
_sections.addAtKey(sheetNode->attribute( c_ContentType), section);
} }
@@ -189,6 +197,8 @@ void XQViewModel::onActionTriggered(QAction* action)
void XQViewModel::onCommandRedo( XQCommand& command ) void XQViewModel::onCommandRedo( XQCommand& command )
{ {
QMap<XQCommand::CmdType,std::function<void(XQCommand&)>> s_RedoMap;
try try
{ {
@@ -283,15 +293,18 @@ void XQViewModel::cmdCut( XQCommand& command )
{ {
// ... holen das erste item, das auch den content node enthält // ... holen das erste item, das auch den content node enthält
//const XQNodeBackup& entry = *it; //const XQNodeBackup& entry = *it;
//XQItem& firstItem = xqFirstItem( (*it).itemPos );
//qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id;
// jetzt löschen, dabei wird die parent-verbindung entfernt // jetzt löschen, dabei wird die parent-verbindung entfernt
const XQNodeBackup& entry = *it; const XQNodeBackup& entry = *it;
XQItem& firstItem = xqFirstItem( (*it).itemPos );
qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id;
entry.contentNode->unlink_self(); entry.contentNode->unlink_self();
removeRow(entry.itemPos ); removeRow(entry.itemPos );
} }
} }
//! entfernte knoten wieder einfügen , 'command' enthält die liste //! entfernte knoten wieder einfügen , 'command' enthält die liste
void XQViewModel::cmdCutUndo( XQCommand& command ) void XQViewModel::cmdCutUndo( XQCommand& command )
@@ -306,7 +319,7 @@ void XQViewModel::cmdCutUndo( XQCommand& command )
const XQNodePtr& savedNode = entry.contentNode; const XQNodePtr& savedNode = entry.contentNode;
// __fix! should not be _contentRoot! // __fix! should not be _contentRoot!
savedNode->add_me_at( entry.nodePos, _contentRoot ); savedNode->add_me_at( entry.nodePos, _contentRoot );
XQItemList list = _itemFactory.makeContentRow( savedNode, section.sheetRootNode ); XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, savedNode );
XQItem& firstItem = *((XQItem*)list[0]); XQItem& firstItem = *((XQItem*)list[0]);
qDebug() << " --- Cut Undo: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id << " count: " << entry.contentNode.use_count(); qDebug() << " --- Cut Undo: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id << " count: " << entry.contentNode.use_count();
@@ -341,7 +354,7 @@ void XQViewModel::cmdPaste( XQCommand& command )
XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode ); XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode );
newNode->clone(section.contentRootNode )->add_me_at( nodePos ); newNode->clone(section.contentRootNode )->add_me_at( nodePos );
// ... und damit eine frische item-row erzeugen // ... und damit eine frische item-row erzeugen
XQItemList list = _itemFactory.makeContentRow( newNode, section.sheetRootNode ); XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, newNode );
insertRow( insRow, list ); insertRow( insRow, list );
// die neue item-row selektieren // die neue item-row selektieren
const QModelIndex& selIdx = list[0]->index(); const QModelIndex& selIdx = list[0]->index();
@@ -424,7 +437,7 @@ void XQViewModel::cmdNew( XQCommand& command )
// store node in node->parent() // store node in node->parent()
//node->add_before_me( newNode ); //node->add_before_me( newNode );
// store node also in 'command' to enable undo // store node also in 'command' to enable undo
const XQModelSection& section = _sections.sectionxqItemFromIndex( origin ); const XQModelSection& section = _sections.sectionFromIndex( origin );
// create new item row // create new item row
XQItemList list = _itemFactory.createGenericRow( newNode, section.sheetRootNode ); XQItemList list = _itemFactory.createGenericRow( newNode, section.sheetRootNode );
@@ -504,15 +517,6 @@ void XQViewModel::setupViewProperties()
} }
//! füg eine section mit header hinzu.
void XQViewModel::addSection( const XQItemList& list, const XQNodePtr& sheetNode )
{
appendRow(list);
_sections.addSectionEntry( list[0]->index(), sheetNode );
}
//! gibt den undo-stack zurück. //! gibt den undo-stack zurück.
QUndoStack* XQViewModel::undoStack() QUndoStack* XQViewModel::undoStack()

View File

@@ -48,7 +48,6 @@ public:
QUndoStack* undoStack(); QUndoStack* undoStack();
void setUndoStack( QUndoStack* undoStack ); void setUndoStack( QUndoStack* undoStack );
//! create the own model structure
virtual void initModel( const QString& modelName); virtual void initModel( const QString& modelName);
//little helpers //little helpers
@@ -73,7 +72,7 @@ public:
/*! /*!
Derzeit wir die default-implementierung von data/setData genutzt. hier wäre dann die Derzeit wird die default-implementierung von data/setData genutzt. hier wäre dann die
Stelle um setData & data an externe 'handler' umzubiegen, siehe giovannies 'model-injection' Stelle um setData & data an externe 'handler' umzubiegen, siehe giovannies 'model-injection'
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override
@@ -105,9 +104,6 @@ signals:
protected: protected:
void addSection(const XQItemList& list, const XQNodePtr& sheetNode ); void addSection(const XQItemList& list, const XQNodePtr& sheetNode );
protected:
virtual void initContextMenu() = 0; virtual void initContextMenu() = 0;
// __fixme: should be created from xml // __fixme: should be created from xml

View File

@@ -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;
} }

View File

@@ -15,7 +15,6 @@ HEADERS += \
application/xqmainmodel.h \ application/xqmainmodel.h \
application/xqmainwindow.h \ application/xqmainwindow.h \
application/xqappdata.h \ application/xqappdata.h \
items/xqgenericitem.h \
items/xqitem.h \ items/xqitem.h \
items/xqitemfactory.h \ items/xqitemfactory.h \
items/xqitemtype.h \ items/xqitemtype.h \
@@ -52,7 +51,6 @@ SOURCES += \
application/xqmainmodel.cpp \ application/xqmainmodel.cpp \
application/xqmainwindow.cpp \ application/xqmainwindow.cpp \
application/xqappdata.cpp \ application/xqappdata.cpp \
items/xqgenericitem.cpp \
items/xqitem.cpp \ items/xqitem.cpp \
items/xqitemfactory.cpp \ items/xqitemfactory.cpp \
items/xqitemtype.cpp \ items/xqitemtype.cpp \

View File

@@ -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">

View File

@@ -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"/>

View File

@@ -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"/>

View File

@@ -8,41 +8,20 @@
<ItemTypes> <ItemTypes>
<TreeParentType RenderStyle="PlainStyle" ItemFlags="IsEnabled|IsDropEnabled" Icon="DirIcon" /> <TreeParentType RenderStyle="PlainStyle" ItemFlags="IsEnabled|IsDropEnabled" Icon="DirIcon" />
<TreeChildType RenderStyle="PlainStyle" ItemFlags="IsEnabled|IsDragEnabled|IsSelectable|IsDropEnabled"/> <TreeChildType RenderStyle="PlainStyle" ItemFlags="IsCheckable|IsEnabled|IsDragEnabled|IsSelectable|IsDropEnabled"/>
<HeaderType RenderStyle="HeaderStyle" ItemFlags="IsEnabled" Icon="battery"/> <HeaderType RenderStyle="HeaderStyle" ItemFlags="IsCheckable|IsEnabled" Icon="DirIcon"/>
<HiddenType RenderStyle="HiddenStyle"/> <HiddenType RenderStyle="HiddenStyle"/>
<StaticType RenderStyle="PlainStyle"/> <StaticType RenderStyle="PlainStyle"/>
<PlainType RenderStyle="PlainStyle" ItemFlags="IsEnabled|IsEditable|IsSelectable"/> <PlainType RenderStyle="PlainStyle" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
<ValueType RenderStyle="FormattedStyle" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="Coulomb"/> <ValueType RenderStyle="FormattedStyle" ItemFlags="IsEnabled|IsEditable|IsSelectable" Icon="DirIcon" UnitType="Coulomb"/>
<PercentageType RenderStyle="ProgressBarStyle" ItemFlags="IsEnabled|IsSelectable"/> <PercentageType RenderStyle="ProgressBarStyle" ItemFlags="IsEnabled|IsSelectable"/>
<ChoiceType RenderStyle="ComboBoxStyle" ItemFlags="IsEnabled|IsSelectable|IsEditable" FixedChoices="la|le|lo|lu"/> <ChoiceType RenderStyle="ComboBoxStyle" ItemFlags="IsEnabled|IsSelectable|IsEditable" FixedChoices="la|le|lo|lu"/>
<IntValueType RenderStyle="SpinBoxStyle" ItemFlags="IsEnabled|IsSelectable"/> <IntValueType RenderStyle="SpinBoxStyle" ItemFlags="IsEnabled|IsSelectable"/>
</ItemTypes> </ItemTypes>
<!--
DocumentTreeModel
-->
<!--
<DocumentTreeModel> <DocumentTreeModel>
<ActiveProjects ItemType="PlainType" HeaderItemType="TreeParentType" HeaderCaption="Active Projects" State="runnning"> <Section ContentType="runnning">
<Project ItemType="TreeChildType" Icon="list-add"/>
</ActiveProjects>
<PlannedProjects HeaderItemType="TreeParentType" HeaderCaption="Planned Projects" State="planned">
<Project ItemType="TreeChildType" Icon="list-add"/>
</PlannedProjects>
<FinishedProjects HeaderItemType="TreeParentType" HeaderCaption="Finished Projects" State="finished">
<Project ItemType="TreeChildType" Icon="list-remove"/>
</FinishedProjects>
</DocumentTreeModel>
-->
<!--
DocumentDetailsModel:
-->
<DocumentTreeModel>
<Section State="runnning">
<Header> <Header>
<Entry Caption="Active Projects" ItemType="TreeParentType"/> <Entry Caption="Active Projects" ItemType="TreeParentType"/>
</Header> </Header>
@@ -50,7 +29,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 +37,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>
@@ -66,43 +45,41 @@
<Project Caption="@ProjectName" ItemType="TreeParentType"/> <Project Caption="@ProjectName" ItemType="TreeParentType"/>
</Data> </Data>
</Section> </Section>
</DocumentTreeModel> </DocumentTreeModel>
<DocumentDetailsModel> <DocumentDetailsModel>
<Panel FriendlyName="@PanelName"> <Section ContentType="Panel">
<PanelID HeaderCaption="Panel" HeaderItemType="HeaderType" ItemType="PlainType" Icon="icn74Dummy"/> <Header Marker="Panel">
<PanelName HeaderCaption="Name" HeaderItemType="HeaderType" ItemType="PlainType"/> <PanelID Caption="Panel" ItemType="HeaderType" />
<Manufacturer HeaderCaption="Manufacturer" HeaderItemType="HeaderType" ItemType="ValueType"/> <PanelName Caption="Name" ItemType="HeaderType" Icon="BrowserStop" />
<WattPeak HeaderCaption="Watt Peak" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="Wp"/> <Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
<Width HeaderCaption="Width" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="m"/> <WattPeak Caption="Watt Peak" ItemType="HeaderType" />
<Height HeaderCaption="Height" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="m"/> <Width Caption="Width" ItemType="HeaderType" />
<Weight HeaderCaption="Weight" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="kg"/> <Height Caption="Height" ItemType="HeaderType" />
<MaxVolt HeaderCaption="max. Volt" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="V"/> <Wight Caption="Weight" ItemType="HeaderType" />
<MaxAmpere HeaderCaption="max. Ampere" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="A"/> <MaxVolt Caption="max. Volt" ItemType="HeaderType" />
</Panel> <MaxAmpere Caption="max. Ampere" ItemType="HeaderType" />
</Header>
<Data>
<!-- 'Icon' überschreibt den default wert im ItemType und erzeugt damit einen neuen ItemType-->
<PanelID ItemType="PlainType" Icon="DesktopIcon"/>
<PanelName ItemType="PlainType" Icon="BrowserStop"/>
<Manufacturer ItemType="ValueType"/>
<!-- 'UnitType' überschreibt den default wert im ItemType und erzeugt damit einen neuen ItemType-->
<WattPeak ItemType="ValueType" UnitType="Wp" Icon="DesktopIcon"/>
<Width ItemType="ValueType" UnitType="m"/>
<Height ItemType="ValueType" UnitType="m"/>
<Weight ItemType="ValueType" UnitType="kg"/>
<MaxVolt ItemType="ValueType" UnitType="V"/>
<MaxAmpere ItemType="ValueType" UnitType="A"/>
</Data>
</Section>
<Inverter FriendlyName="@InverterName">
<InverterID HeaderCaption="Inverter" HeaderItemType="HeaderType" ItemType="ValueType"/>
<InverterName HeaderCaption="Name" HeaderItemType="HeaderType" ItemType="ValueType"/>
<Manufacturer HeaderCaption="Manufacturer" HeaderItemType="HeaderType" ItemType="ValueType"/>
<MaxPowerInput HeaderCaption="max. Input" HeaderItemType="HeaderType" ItemType="ChoiceType" ChoiceDataSource="MaxPowerInputChoice" UnitType="W"/>
<MaxPowerOutput HeaderCaption="max Output" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="W"/>
<NumStrings HeaderCaption="Strings" HeaderItemType="HeaderType" ItemType="ValueType"/>
<Weight HeaderCaption="Weight" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="kg"/>
</Inverter>
<Battery FriendlyName="@BatteryName">
<BatteryID HeaderCaption="Battery" HeaderItemType="HeaderType" ItemType="ValueType"/>
<BatteryName HeaderCaption="Name" HeaderItemType="HeaderType" ItemType="ValueType"/>
<Manufacturer HeaderCaption="Manufacturer" HeaderItemType="HeaderType" ItemType="ValueType"/>
<Capacity HeaderCaption="Capacity" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="Wh"/>
<Yield HeaderCaption="Yield" HeaderItemType="HeaderType" ItemType="PercentageType" UnitType="%"/>
<MaxCurrent HeaderCaption="max. Current" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="A"/>
<MaxVolt HeaderCaption="max. Volt" HeaderItemType="HeaderType" ItemType="ValueType" UnitType="V"/>
</Battery>
</DocumentDetailsModel> </DocumentDetailsModel>