You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWATI/Include/iBase/iProperty/ZxPtyAttributeFile.h

81 lines
1.8 KiB
C

#include <QString>
#include <QHash>
#include "iProperty_global.h"
class ZxXpfDoc;
class ZxXpfNode;
class QDomElement;
class ZxPtyFileManager;
/// 属性配置文件
class I_PROPERTY_EXPORT ZxPtyAttributeFile
{
ZxPtyAttributeFile(ZxPtyFileManager* pManager);
~ZxPtyAttributeFile();
public:
// 常规参数
ZxXpfDoc* getXpfDoc() const;
const QString& getName() const;
const QString& getPath() const;
// 检索
ZxXpfNode* getItemConfig(const QString& key, bool bConsiderParent = true);
// 排序
int getItemOrder(const QString& key) const;
// 临时TODO不一定准确
// 为了配置方便对于英文版暂时用了Name来做Label所以需要判断当前是否 非英文版
bool isLangCn();
private:
// 正式应用(新版)
bool load_new(const QString& sPath, const QString& sName);
bool parsePtyNodes(QDomElement& e, QString sPrev);
#ifdef _SCAN_OLD_CODE_
bool load(const QString& sPath, const QString& sName);
// 排序
QStringList getAllItemConfigKeys(bool bAlphabetical = false);
QStringList getAllItemConfigKeysAlphabetical();
QStringList getAllItemConfigKeysDisplayOrder();
// 废弃
void loadOrder();
void saveOrder();
void mergeOrder(QStringList & dst, const QStringList & src);
ZxPtyAttributeFile* getBase() const;
void setItemOrder(const QString& key, int order);
void clearOrder();
void orderSyncWithBase(bool includeDerived = false);
#endif
bool save();
private:
ZxPtyFileManager* m_pManager;
ZxPtyAttributeFile* m_pBase;
ZxXpfDoc* m_pDoc;
QString m_sPath;
QString m_sName;
mutable QHash<QString, int> m_hashOrders;
mutable int m_nNextItemOrder;
friend class ZxPtyPano;
friend class ZxPtyFileManager;
};