annotate widgets/ProgressDialog.h @ 1267:b68f3162b5a8

Accept optional modality in constructor and fix subsequent possible side effect (re-opening dialog when just cancelled)
author Lucas Thompson <dev@lucas.im>
date Tue, 17 Apr 2018 10:47:14 +0100
parents 33b7f5e54d60
children 05d12869043e
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@378 16 #ifndef _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@1267 28 ProgressDialog(
dev@1267 29 QString message,
dev@1267 30 bool cancellable,
dev@1267 31 int timeBeforeShow = 0,
dev@1267 32 QWidget *parent = 0,
dev@1267 33 Qt::WindowModality modality = Qt::NonModal
dev@1267 34 );
Chris@378 35 virtual ~ProgressDialog();
Chris@378 36
Chris@410 37 virtual bool isDefinite() const;
Chris@410 38 virtual void setDefinite(bool definite);
Chris@410 39
Chris@410 40 virtual bool wasCancelled() const;
Chris@410 41
Chris@378 42 signals:
Chris@410 43 void showing();
Chris@378 44 void cancelled();
Chris@378 45
Chris@378 46 public slots:
Chris@378 47 virtual void setMessage(QString text);
Chris@378 48 virtual void setProgress(int percentage);
Chris@378 49
Chris@378 50 protected slots:
Chris@378 51 virtual void showTimerElapsed();
Chris@410 52 void canceled();
Chris@378 53
Chris@378 54 protected:
Chris@378 55 QProgressDialog *m_dialog;
Chris@378 56 QTimer *m_showTimer;
Chris@378 57 bool m_timerElapsed;
Chris@410 58 bool m_cancelled;
Chris@378 59 };
Chris@378 60
Chris@378 61 #endif