annotate widgets/TipDialog.h @ 449:f2ef0ff2e3b0

* minor text change
author Chris Cannam
date Wed, 19 Nov 2008 21:36:33 +0000
parents 1c4c9e3e44e6
children 1fe7951a61e8
rev   line source
Chris@225 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@225 2
Chris@225 3 /*
Chris@225 4 Sonic Visualiser
Chris@225 5 An audio file viewer and annotation editor.
Chris@225 6 Centre for Digital Music, Queen Mary, University of London.
Chris@225 7 This file copyright 2007 QMUL.
Chris@225 8
Chris@225 9 This program is free software; you can redistribute it and/or
Chris@225 10 modify it under the terms of the GNU General Public License as
Chris@225 11 published by the Free Software Foundation; either version 2 of the
Chris@225 12 License, or (at your option) any later version. See the file
Chris@225 13 COPYING included with this distribution for more information.
Chris@225 14 */
Chris@225 15
Chris@225 16 #ifndef _TIP_DIALOG_H_
Chris@225 17 #define _TIP_DIALOG_H_
Chris@225 18
Chris@225 19 #include <QDialog>
Chris@225 20 #include <QString>
Chris@225 21 #include <QXmlDefaultHandler>
Chris@225 22
Chris@225 23 #include <vector>
Chris@225 24
Chris@225 25 class QLabel;
Chris@225 26 class QXmlInputSource;
Chris@225 27
Chris@225 28 class TipDialog : public QDialog
Chris@225 29 {
Chris@225 30 Q_OBJECT
Chris@225 31
Chris@225 32 public:
Chris@225 33 TipDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
Chris@225 34 virtual ~TipDialog();
Chris@225 35
Chris@225 36 bool isOK() { return !m_tips.empty(); }
Chris@225 37
Chris@225 38 protected slots:
Chris@225 39 void previous();
Chris@225 40 void next();
Chris@225 41
Chris@225 42 protected:
Chris@225 43 int m_tipNumber;
Chris@225 44 QLabel *m_label;
Chris@225 45 QString m_caption;
Chris@225 46
Chris@225 47 std::vector<QString> m_tips;
Chris@225 48
Chris@225 49 void readTips();
Chris@225 50 void showTip();
Chris@225 51
Chris@225 52 class TipFileParser : public QXmlDefaultHandler
Chris@225 53 {
Chris@225 54 public:
Chris@225 55 TipFileParser(TipDialog *dialog);
Chris@225 56 virtual ~TipFileParser();
Chris@225 57
Chris@225 58 void parse(QXmlInputSource &source);
Chris@225 59
Chris@225 60 virtual bool startElement(const QString &namespaceURI,
Chris@225 61 const QString &localName,
Chris@225 62 const QString &qName,
Chris@225 63 const QXmlAttributes& atts);
Chris@225 64
Chris@225 65 virtual bool characters(const QString &);
Chris@225 66
Chris@225 67 virtual bool endElement(const QString &namespaceURI,
Chris@225 68 const QString &localName,
Chris@225 69 const QString &qName);
Chris@225 70
Chris@225 71 bool error(const QXmlParseException &exception);
Chris@225 72 bool fatalError(const QXmlParseException &exception);
Chris@225 73
Chris@225 74 protected:
Chris@225 75 TipDialog *m_dialog;
Chris@225 76
Chris@225 77 bool m_inTip;
Chris@225 78 bool m_inText;
Chris@228 79 bool m_inHtml;
Chris@225 80 };
Chris@225 81 };
Chris@225 82
Chris@225 83 #endif