00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _TIP_DIALOG_H_
00017 #define _TIP_DIALOG_H_
00018
00019 #include <QDialog>
00020 #include <QString>
00021 #include <QXmlDefaultHandler>
00022
00023 #include <vector>
00024
00025 class QLabel;
00026 class QXmlInputSource;
00027
00028 class TipDialog : public QDialog
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 TipDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
00034 virtual ~TipDialog();
00035
00036 bool isOK() { return !m_tips.empty(); }
00037
00038 protected slots:
00039 void previous();
00040 void next();
00041
00042 protected:
00043 int m_tipNumber;
00044 QLabel *m_label;
00045 QString m_caption;
00046
00047 std::vector<QString> m_tips;
00048
00049 void readTips();
00050 void showTip();
00051
00052 class TipFileParser : public QXmlDefaultHandler
00053 {
00054 public:
00055 TipFileParser(TipDialog *dialog);
00056 virtual ~TipFileParser();
00057
00058 void parse(QXmlInputSource &source);
00059
00060 virtual bool startElement(const QString &namespaceURI,
00061 const QString &localName,
00062 const QString &qName,
00063 const QXmlAttributes& atts);
00064
00065 virtual bool characters(const QString &);
00066
00067 virtual bool endElement(const QString &namespaceURI,
00068 const QString &localName,
00069 const QString &qName);
00070
00071 bool error(const QXmlParseException &exception);
00072 bool fatalError(const QXmlParseException &exception);
00073
00074 protected:
00075 TipDialog *m_dialog;
00076
00077 bool m_inTip;
00078 bool m_inText;
00079 bool m_inHtml;
00080 };
00081 };
00082
00083 #endif