annotate widgets/TipDialog.h @ 1410:d057dcc827e7 fix-static-analysis

Merge from default branch
author Chris Cannam
date Tue, 04 Dec 2018 13:49:09 +0000
parents 05d614f6e46d
children
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@1407 16 #ifndef SV_TIP_DIALOG_H
Chris@1407 17 #define SV_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@584 25 #include "base/Debug.h"
Chris@584 26
Chris@225 27 class QLabel;
Chris@225 28 class QXmlInputSource;
Chris@225 29
Chris@225 30 class TipDialog : public QDialog
Chris@225 31 {
Chris@225 32 Q_OBJECT
Chris@225 33
Chris@225 34 public:
Chris@616 35 TipDialog(QWidget *parent = 0);
Chris@225 36 virtual ~TipDialog();
Chris@225 37
Chris@225 38 bool isOK() { return !m_tips.empty(); }
Chris@225 39
Chris@225 40 protected slots:
Chris@225 41 void previous();
Chris@225 42 void next();
Chris@225 43
Chris@225 44 protected:
Chris@225 45 int m_tipNumber;
Chris@225 46 QLabel *m_label;
Chris@225 47 QString m_caption;
Chris@225 48
Chris@225 49 std::vector<QString> m_tips;
Chris@225 50
Chris@225 51 void readTips();
Chris@225 52 void showTip();
Chris@225 53
Chris@225 54 class TipFileParser : public QXmlDefaultHandler
Chris@225 55 {
Chris@225 56 public:
Chris@225 57 TipFileParser(TipDialog *dialog);
Chris@225 58 virtual ~TipFileParser();
Chris@225 59
Chris@225 60 void parse(QXmlInputSource &source);
Chris@225 61
Chris@1406 62 bool startElement(const QString &namespaceURI,
Chris@225 63 const QString &localName,
Chris@225 64 const QString &qName,
Chris@1406 65 const QXmlAttributes& atts) override;
Chris@225 66
Chris@1406 67 bool characters(const QString &) override;
Chris@225 68
Chris@1406 69 bool endElement(const QString &namespaceURI,
Chris@225 70 const QString &localName,
Chris@1406 71 const QString &qName) override;
Chris@225 72
Chris@1406 73 bool error(const QXmlParseException &exception) override;
Chris@1406 74 bool fatalError(const QXmlParseException &exception) override;
Chris@225 75
Chris@225 76 protected:
Chris@225 77 TipDialog *m_dialog;
Chris@225 78
Chris@225 79 bool m_inTip;
Chris@225 80 bool m_inText;
Chris@228 81 bool m_inHtml;
Chris@225 82 };
Chris@225 83 };
Chris@225 84
Chris@225 85 #endif