libyui-qt  2.46.13
YQDownloadProgress.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YQDownloadProgress.h
20 
21  Author: Stefan Hundhammer <sh@suse.de>
22 
23 /-*/
24 
25 
26 #ifndef YQDownloadProgress_h
27 #define YQDownloadProgress_h
28 
29 #include <QFrame>
30 #include <yui/YDownloadProgress.h>
31 
32 class YQWidgetCaption;
33 class QProgressBar;
34 
35 
36 class YQDownloadProgress : public QFrame, public YDownloadProgress
37 {
38  Q_OBJECT
39 
40 public:
41 
42  /**
43  * Constructor.
44  **/
45  YQDownloadProgress( YWidget * parent,
46  const std::string & label,
47  const std::string & filename,
48  YFileSize_t expectedSize );
49 
50  /**
51  * Destructor.
52  **/
53  virtual ~YQDownloadProgress();
54 
55  /**
56  * Set the label (the text above the progress bar).
57  *
58  * Reimplemented from YDownloadProgress.
59  **/
60  virtual void setLabel( const std::string & label );
61 
62  /**
63  * Set the name of a new file to monitor.
64  *
65  * Reimplemented from YDownloadProgress.
66  **/
67  virtual void setFilename( const std::string & filename );
68 
69  /**
70  * Change the expected file size.
71  *
72  * Reimplemented from YDownloadProgress.
73  **/
74  virtual void setExpectedSize( YFileSize_t expectedSize );
75 
76  /**
77  * Set enabled/disabled state.
78  *
79  * Reimplemented from YWidget.
80  **/
81  virtual void setEnabled( bool enabled );
82 
83  /**
84  * Preferred width of the widget.
85  *
86  * Reimplemented from YWidget.
87  **/
88  virtual int preferredWidth();
89 
90  /**
91  * Preferred height of the widget.
92  *
93  * Reimplemented from YWidget.
94  **/
95  virtual int preferredHeight();
96 
97  /**
98  * Set the new size of the widget.
99  *
100  * Reimplemented from YWidget.
101  **/
102  virtual void setSize( int newWidth, int newHeight );
103 
104 
105 public slots:
106  /**
107  * Slot for polling and displaying the file size.
108  **/
109  void pollFileSize( void );
110 
111 
112 protected:
113 
114  YQWidgetCaption * _caption;
115  QProgressBar * _qt_progressBar;
116  QTimer * _timer;
117 };
118 
119 
120 #endif // YQDownloadProgress_h
virtual int preferredWidth()
Preferred width of the widget.
virtual void setEnabled(bool enabled)
Set enabled/disabled state.
virtual int preferredHeight()
Preferred height of the widget.
virtual void setExpectedSize(YFileSize_t expectedSize)
Change the expected file size.
virtual ~YQDownloadProgress()
Destructor.
virtual void setSize(int newWidth, int newHeight)
Set the new size of the widget.
YQDownloadProgress(YWidget *parent, const std::string &label, const std::string &filename, YFileSize_t expectedSize)
Constructor.
virtual void setFilename(const std::string &filename)
Set the name of a new file to monitor.
Helper class for captions (labels) above a widget: Takes care of hiding itself when its text is empty...
void pollFileSize(void)
Slot for polling and displaying the file size.
virtual void setLabel(const std::string &label)
Set the label (the text above the progress bar).