1 /*
2     This file is part of Android File Transfer For Linux.
3     Copyright (C) 2015-2020  Vladimir Menshakov
4 
5     This library is free software; you can redistribute it and/or modify it
6     under the terms of the GNU Lesser General Public License as published by
7     the Free Software Foundation; either version 2.1 of the License,
8     or (at your option) any later version.
9 
10     This library is distributed in the hope that it will be useful, but
11     WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14 
15     You should have received a copy of the GNU Lesser General Public License
16     along with this library; if not, write to the Free Software Foundation,
17     Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef AFTL_QT_PROGRESSDIALOG_H
21 #define AFTL_QT_PROGRESSDIALOG_H
22 
23 #include <QDialog>
24 
25 namespace Ui {
26 class ProgressDialog;
27 }
28 
29 class QPropertyAnimation;
30 
31 class ProgressDialog : public QDialog
32 {
33 	Q_OBJECT
34 	Q_PROPERTY(float progress READ progress WRITE setProgress);
35 
36 public:
37 	explicit ProgressDialog(QWidget *parent = 0, bool showAbort = true);
38 	~ProgressDialog();
39 
progress()40 	float progress() const
41 	{ return _progress; }
42 
43 	void setProgress(float value);
44 
45 signals:
46 	void abort();
47 
48 public slots:
49 	void setSpeed(qint64 speed);
50 	void setFilename(const QString &filename);
51 	void setValue(float current);
52 	virtual void reject();
53 
54 private slots:
55 	void onAbortButtonPressed();
56 
57 private:
58 	void closeEvent(QCloseEvent *event);
59 
60 private:
61 	Ui::ProgressDialog *ui;
62 	QPropertyAnimation *_animation;
63 	float				_progress;
64 	int					_duration;
65 };
66 
67 #endif // PROGRESSDIALOG_H
68