Mercurial > hg > svgui
annotate widgets/ProgressDialog.h @ 1614:c6f5c822b10d
Fix potential divide-by-zero (depending on a race elsewhere)
author | Chris Cannam |
---|---|
date | Tue, 30 Jun 2020 10:56:56 +0100 |
parents | 3607b0092019 |
children |
rev | line source |
---|---|
Chris@378 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@378 | 2 |
Chris@378 | 3 /* |
Chris@378 | 4 Sonic Visualiser |
Chris@378 | 5 An audio file viewer and annotation editor. |
Chris@378 | 6 Centre for Digital Music, Queen Mary, University of London. |
Chris@378 | 7 This file copyright 2007-2008 QMUL. |
Chris@378 | 8 |
Chris@378 | 9 This program is free software; you can redistribute it and/or |
Chris@378 | 10 modify it under the terms of the GNU General Public License as |
Chris@378 | 11 published by the Free Software Foundation; either version 2 of the |
Chris@378 | 12 License, or (at your option) any later version. See the file |
Chris@378 | 13 COPYING included with this distribution for more information. |
Chris@378 | 14 */ |
Chris@378 | 15 |
Chris@1407 | 16 #ifndef SV_PROGRESS_DIALOG_H |
Chris@378 | 17 |
Chris@378 | 18 #include "base/ProgressReporter.h" |
Chris@378 | 19 |
Chris@378 | 20 class QProgressDialog; |
Chris@378 | 21 class QTimer; |
Chris@378 | 22 |
Chris@378 | 23 class ProgressDialog : public ProgressReporter |
Chris@378 | 24 { |
Chris@378 | 25 Q_OBJECT |
Chris@378 | 26 |
Chris@378 | 27 public: |
dev@1268 | 28 ProgressDialog(QString message, |
dev@1268 | 29 bool cancellable, |
Chris@1557 | 30 int timeBeforeShow = 0, /* milliseconds */ |
dev@1268 | 31 QWidget *parent = 0, |
dev@1268 | 32 Qt::WindowModality modality = Qt::NonModal); |
Chris@378 | 33 virtual ~ProgressDialog(); |
Chris@378 | 34 |
Chris@1406 | 35 bool isDefinite() const override; |
Chris@1406 | 36 void setDefinite(bool definite) override; |
Chris@410 | 37 |
Chris@1406 | 38 bool wasCancelled() const override; |
Chris@410 | 39 |
Chris@378 | 40 signals: |
Chris@410 | 41 void showing(); |
Chris@378 | 42 void cancelled(); |
Chris@378 | 43 |
Chris@378 | 44 public slots: |
Chris@1406 | 45 void setMessage(QString text) override; |
Chris@1406 | 46 void setProgress(int percentage) override; |
Chris@378 | 47 |
Chris@378 | 48 protected slots: |
Chris@378 | 49 virtual void showTimerElapsed(); |
Chris@410 | 50 void canceled(); |
Chris@378 | 51 |
Chris@378 | 52 protected: |
Chris@378 | 53 QProgressDialog *m_dialog; |
Chris@378 | 54 QTimer *m_showTimer; |
Chris@378 | 55 bool m_timerElapsed; |
Chris@410 | 56 bool m_cancelled; |
Chris@378 | 57 }; |
Chris@378 | 58 |
Chris@378 | 59 #endif |