00001 #ifndef ZKBCFG_H
00002 #define ZKBCFG_H
00003
00004 #include <qxml.h>
00005 #include "zkb.h"
00006 #include "zkbxml.h"
00007
00008 class ZkbConfig : public QXmlErrorHandler {
00009 public:
00010 ZkbConfig(const QString& dir);
00011 virtual ~ZkbConfig();
00012
00013 bool load(const QString& file, Keymap& keymap, const QString& prefix);
00014
00015 virtual bool warning(const QXmlParseException& e);
00016 virtual bool error(const QXmlParseException& e);
00017 virtual bool fatalError(const QXmlParseException& e);
00018 virtual QString errorString();
00019
00020 protected:
00021 QString path;
00022 QMap<QString, int> includedFiles;
00023 QString err;
00024 };
00025
00026 class ZkbHandler : public ZkbXmlHandler {
00027 public:
00028 ZkbHandler(ZkbConfig& zkc, Keymap& keymap, const QString& prefix);
00029 virtual ~ZkbHandler();
00030
00031 protected:
00032 ZkbConfig& zkc;
00033 Keymap& keymap;
00034 QString prefix;
00035
00036
00037 int ardelay;
00038 int arperiod;
00039
00040
00041 QString currentStateName;
00042 State* currentState;
00043
00044
00045 Action* currentAction;
00046
00047 virtual bool startKeymapElement(int ardelay, int arperiod,
00048 const QString& author);
00049 virtual bool startIncludeElement(const QString& file,
00050 const QString& prfix);
00051 virtual bool startLabelElement(const QString& label,
00052 const QString& state);
00053 virtual bool startStateElement(const QString& name,
00054 const QString& parent, bool dflt);
00055 virtual bool startMapElement(int key, bool pressed);
00056 virtual bool startEventElement(int keycode, int unicode, int modifiers,
00057 bool pressed, bool autorepeat);
00058 virtual bool startNextStateElement(const QString& state);
00059
00060 virtual bool endKeymapElement();
00061 virtual bool endIncludeElement();
00062 virtual bool endLabelElement();
00063 virtual bool endStateElement();
00064 virtual bool endMapElement();
00065 virtual bool endEventElement();
00066 virtual bool endNextStateElement();
00067 };
00068
00069 #endif