00001 #ifndef XMLPARSEBASE_H_
00002 #define XMLPARSEBASE_H_
00003
00004 #include <QString>
00005 #include <QMap>
00006
00007 #include "mythrect.h"
00008
00009 class MythUIType;
00010 class MythScreenType;
00011 class QDomElement;
00012 class QBrush;
00013
00014 #define VERBOSE_XML(type, level, filename, element, msg) \
00015 LOG(type, level, LOC + QString("%1\n\t\t\t" \
00016 "Location: %2 @ %3\n\t\t\t" \
00017 "Name: '%4'\tType: '%5'") \
00018 .arg(msg).arg(filename).arg(element.lineNumber()) \
00019 .arg(element.attribute("name", "")).arg(element.tagName()))
00020
00021
00022 class MUI_PUBLIC XMLParseBase
00023 {
00024 public:
00025 static QString getFirstText(QDomElement &element);
00026 static bool parseBool(const QString &text);
00027 static bool parseBool(QDomElement &element);
00028 static MythPoint parsePoint(const QString &text, bool normalize = true);
00029 static MythPoint parsePoint(QDomElement &element, bool normalize = true);
00030 static QSize parseSize(const QString &text, bool normalize = true);
00031 static QSize parseSize(QDomElement &element, bool normalize = true);
00032 static MythRect parseRect(const QString &text, bool normalize = true);
00033 static MythRect parseRect(QDomElement &element, bool normalize = true);
00034 static int parseAlignment(const QString &text);
00035 static int parseAlignment(QDomElement &element);
00036 static QBrush parseGradient(const QDomElement &element);
00037 static QString parseText(QDomElement &element);
00038 static MythUIType *GetGlobalObjectStore(void);
00039 static void ClearGlobalObjectStore(void);
00040
00041 static void ParseChildren(
00042 const QString &filename, QDomElement &element,
00043 MythUIType *parent, bool showWarnings);
00044
00045
00046 static MythUIType *ParseUIType(
00047 const QString &filename,
00048 QDomElement &element, const QString &type,
00049 MythUIType *parent, MythScreenType *screen,
00050 bool showWarnings,
00051 QMap<QString, QString> &parentDependsMap);
00052
00053 static bool WindowExists(const QString &xmlfile, const QString &windowname);
00054 static bool LoadWindowFromXML(const QString &xmlfile,
00055 const QString &windowname,
00056 MythUIType *parent);
00057
00058 static bool LoadBaseTheme(void);
00059 static bool LoadBaseTheme(const QString &baseTheme);
00060
00061 static bool CopyWindowFromBase(const QString &windowname,
00062 MythScreenType *win);
00063
00064 private:
00065 static bool doLoad(const QString &windowname, MythUIType *parent,
00066 const QString &filename,
00067 bool onlyLoadWindows, bool showWarnings);
00068 static void ConnectDependants(MythUIType * parent,
00069 QMap<QString, QString> &dependsMap);
00070
00071 };
00072
00073 #endif