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