[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the Qt3Support module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
[561] | 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef Q3PROGRESSBAR_H
|
---|
| 43 | #define Q3PROGRESSBAR_H
|
---|
| 44 |
|
---|
| 45 | #include <QtGui/qframe.h>
|
---|
| 46 |
|
---|
| 47 | QT_BEGIN_HEADER
|
---|
| 48 |
|
---|
| 49 | QT_BEGIN_NAMESPACE
|
---|
| 50 |
|
---|
| 51 | QT_MODULE(Qt3SupportLight)
|
---|
| 52 |
|
---|
| 53 | #ifndef QT_NO_PROGRESSBAR
|
---|
| 54 |
|
---|
| 55 | class Q3ProgressBarPrivate;
|
---|
| 56 |
|
---|
| 57 | class Q_COMPAT_EXPORT Q3ProgressBar : public QFrame
|
---|
| 58 | {
|
---|
| 59 | Q_OBJECT
|
---|
| 60 | Q_PROPERTY(int totalSteps READ totalSteps WRITE setTotalSteps)
|
---|
| 61 | Q_PROPERTY(int progress READ progress WRITE setProgress)
|
---|
| 62 | Q_PROPERTY(QString progressString READ progressString)
|
---|
| 63 | Q_PROPERTY(bool centerIndicator READ centerIndicator WRITE setCenterIndicator)
|
---|
| 64 | Q_PROPERTY(bool percentageVisible READ percentageVisible WRITE setPercentageVisible)
|
---|
| 65 |
|
---|
| 66 | public:
|
---|
| 67 | Q3ProgressBar(QWidget *parent, const char *name, Qt::WindowFlags f=0);
|
---|
| 68 | Q3ProgressBar(int totalSteps, QWidget *parent, const char *name,
|
---|
| 69 | Qt::WindowFlags f=0);
|
---|
| 70 | Q3ProgressBar(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
---|
| 71 | Q3ProgressBar(int totalSteps, QWidget *parent = 0, Qt::WindowFlags f=0);
|
---|
| 72 |
|
---|
| 73 | int totalSteps() const;
|
---|
| 74 | int progress() const;
|
---|
| 75 | const QString &progressString() const;
|
---|
| 76 |
|
---|
| 77 | QSize sizeHint() const;
|
---|
| 78 | QSize minimumSizeHint() const;
|
---|
| 79 |
|
---|
| 80 | void setCenterIndicator(bool on);
|
---|
| 81 | bool centerIndicator() const;
|
---|
| 82 |
|
---|
| 83 | bool percentageVisible() const;
|
---|
| 84 | void setPercentageVisible(bool);
|
---|
| 85 |
|
---|
| 86 | void setVisible(bool visible);
|
---|
| 87 |
|
---|
| 88 | void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
|
---|
| 89 | int margin() const
|
---|
| 90 | { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
|
---|
| 91 |
|
---|
| 92 | public Q_SLOTS:
|
---|
| 93 | void reset();
|
---|
| 94 | virtual void setTotalSteps(int totalSteps);
|
---|
| 95 | virtual void setProgress(int progress);
|
---|
| 96 | void setProgress(int progress, int totalSteps);
|
---|
| 97 |
|
---|
| 98 | protected:
|
---|
| 99 | void paintEvent(QPaintEvent *);
|
---|
| 100 | virtual bool setIndicator(QString &progress_str, int progress, int totalSteps);
|
---|
| 101 | void changeEvent(QEvent *);
|
---|
| 102 |
|
---|
| 103 | private:
|
---|
| 104 | Q_DISABLE_COPY(Q3ProgressBar)
|
---|
| 105 |
|
---|
| 106 | int total_steps;
|
---|
| 107 | int progress_val;
|
---|
| 108 | int percentage;
|
---|
| 109 | QString progress_str;
|
---|
| 110 | bool center_indicator : 1;
|
---|
| 111 | bool percentage_visible : 1;
|
---|
| 112 | Q3ProgressBarPrivate *d;
|
---|
| 113 | void initFrame();
|
---|
| 114 | };
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | inline int Q3ProgressBar::totalSteps() const
|
---|
| 118 | {
|
---|
| 119 | return total_steps;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | inline int Q3ProgressBar::progress() const
|
---|
| 123 | {
|
---|
| 124 | return progress_val;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | inline const QString &Q3ProgressBar::progressString() const
|
---|
| 128 | {
|
---|
| 129 | return progress_str;
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | inline bool Q3ProgressBar::centerIndicator() const
|
---|
| 133 | {
|
---|
| 134 | return center_indicator;
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | inline bool Q3ProgressBar::percentageVisible() const
|
---|
| 138 | {
|
---|
| 139 | return percentage_visible;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | #endif // QT_NO_PROGRESSBAR
|
---|
| 143 |
|
---|
| 144 | QT_END_NAMESPACE
|
---|
| 145 |
|
---|
| 146 | QT_END_HEADER
|
---|
| 147 |
|
---|
| 148 | #endif // Q3PROGRESSBAR_H
|
---|