TipDialog.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2007 QMUL.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
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

Generated on Wed Feb 20 15:45:29 2008 for SonicVisualiser by  doxygen 1.5.1