- Don't create layouts with parent. Qt 4.x automatically reparents
[duncan/yast2-qt4.git] / src / YQDownloadProgress.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQDownloadProgress.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQDownloadProgress_h
21 #define YQDownloadProgress_h
22
23 #include <QFrame>
24 #include "YDownloadProgress.h"
25
26 class YQWidgetCaption;
27 class QProgressBar;
28
29
30 class YQDownloadProgress : public QFrame, public YDownloadProgress
31 {
32     Q_OBJECT
33
34 public:
35
36     /**
37      * Constructor.
38      **/
39     YQDownloadProgress( YWidget *       parent,
40                         const string &  label,
41                         const string &  filename,
42                         YFileSize_t     expectedSize );
43
44     /**
45      * Destructor.
46      **/
47     virtual ~YQDownloadProgress();
48
49     /**
50      * Set the label (the text above the progress bar).
51      *
52      * Reimplemented from YDownloadProgress.
53      **/
54     virtual void setLabel( const string & label );
55
56     /**
57      * Set the name of a new file to monitor.
58      *
59      * Reimplemented from YDownloadProgress.
60      **/
61     virtual void setFilename( const string & filename );
62
63     /**
64      * Change the expected file size.
65      *
66      * Reimplemented from YDownloadProgress.
67      **/
68     virtual void setExpectedSize( YFileSize_t expectedSize );
69
70     /**
71      * Set enabled/disabled state.
72      *
73      * Reimplemented from YWidget.
74      **/
75     virtual void setEnabled( bool enabled );
76
77     /**
78      * Preferred width of the widget.
79      *
80      * Reimplemented from YWidget.
81      **/
82     virtual int preferredWidth();
83
84     /**
85      * Preferred height of the widget.
86      *
87      * Reimplemented from YWidget.
88      **/
89     virtual int preferredHeight();
90
91     /**
92      * Set the new size of the widget.
93      *
94      * Reimplemented from YWidget.
95      **/
96     virtual void setSize( int newWidth, int newHeight );
97
98
99 public slots:
100     /**
101      * Slot for polling and displaying the file size.
102      **/
103     void pollFileSize( void );
104
105
106 protected:
107
108     YQWidgetCaption *   _caption;
109     QProgressBar *      _qt_progressBar;
110     QTimer *            _timer;
111 };
112
113
114 #endif // YQDownloadProgress_h