1 /*******************************************************************
2 
3 Part of the Fritzing project - http://fritzing.org
4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de
5 
6 Fritzing is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 Fritzing is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with Fritzing.  If not, see <http://www.gnu.org/licenses/>.
18 
19 ********************************************************************
20 
21 $Revision: 6904 $:
22 $Author: irascibl@gmail.com $:
23 $Date: 2013-02-26 16:26:03 +0100 (Di, 26. Feb 2013) $
24 
25 ********************************************************************/
26 
27 
28 #ifndef FILEPROGRESSDIALOG_H
29 #define FILEPROGRESSDIALOG_H
30 
31 #include <QDialog>
32 #include <QProgressBar>
33 #include <QLabel>
34 #include <QDomElement>
35 #include <QTimer>
36 
37 class FileProgressDialog : public QDialog
38 {
39 Q_OBJECT
40 
41 public:
42 	FileProgressDialog(QWidget *parent = 0);
43     FileProgressDialog(const QString & title, int initialMaximum, QWidget *parent);
44 	~FileProgressDialog();
45 
46 	int value();
47 	void setBinLoadingCount(int);
48 	void setBinLoadingChunk(int);
49     void setIncValueMod(int);
50     void setIndeterminate();
51 
52 protected:
53 	void closeEvent(QCloseEvent *);
54 	void resizeEvent(QResizeEvent *);
55 
56 public slots:
57 	void setMinimum(int);
58 	void setMaximum(int);
59     void addMaximum(int);
60 	void setValue(int);
61 	void incValue();
62 	void setMessage(const QString & message);
63 	void sendCancel();
64 
65 	void loadingInstancesSlot(class ModelBase *, QDomElement & instances);
66 	void loadingInstanceSlot(class ModelBase *, QDomElement & instance);
67 	void settingItemSlot();
68 
69 protected slots:
70     void updateIndeterminate();
71 
72 
73 signals:
74 	void cancel();
75 
76 protected:
77 	void init(const QString & title, int initialMaximum);
78 
79 protected:
80 	QProgressBar * m_progressBar;
81 	QLabel * m_message;
82 
83 	int m_binLoadingCount;
84 	int m_binLoadingIndex;
85 	int m_binLoadingStart;
86     int m_binLoadingChunk;
87     int m_incValueMod;
88 	double m_binLoadingInc;
89 	double m_binLoadingValue;
90     QTimer m_timer;
91 };
92 
93 
94 #endif
95