aboutsummaryrefslogtreecommitdiffstats
path: root/src/winextras/qwintaskbarprogress.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-09-05 00:19:51 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-10 13:29:27 +0200
commit105d6758d96e2c723c885efa4dc82938f2cc2d1f (patch)
treeabd6f5d20469e8a1d86167a63ccd6a16f34b1b25 /src/winextras/qwintaskbarprogress.cpp
parent5f4df5a39be121ca60cac2b06cf94bead76d74d9 (diff)
Introduce TaskbarProgress::stop()
Change-Id: Id37e6c5e41ab196cd72148b3242332796b1c54ef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Ivan Vizir <define-true-false@yandex.com> Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
Diffstat (limited to 'src/winextras/qwintaskbarprogress.cpp')
-rw-r--r--src/winextras/qwintaskbarprogress.cpp81
1 files changed, 37 insertions, 44 deletions
diff --git a/src/winextras/qwintaskbarprogress.cpp b/src/winextras/qwintaskbarprogress.cpp
index a851aee..93bae9d 100644
--- a/src/winextras/qwintaskbarprogress.cpp
+++ b/src/winextras/qwintaskbarprogress.cpp
@@ -55,27 +55,14 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QWinTaskbarProgress::stateChanged(ProgressState state)
-
- This signal is emitted when the \c state property changes its value.
- The \a state argument contains the new value.
- */
-
-/*!
\fn void QWinTaskbarProgress::valueChanged(int value)
This signal is emitted when the progress indicator \a value changes.
*/
/*!
- \enum QWinTaskbarProgress::ProgressState
-
- This enum type specifies the state of the progress indicator.
-
- \value NormalState
- The progress indicator is green.
- \value ErrorState
- The progress indicator turns red.
+ \fn void QWinTaskbarProgress::stoppedChanged(bool stopped)
+ \internal (for QWinTaskbarButton and QML compatibility)
*/
class QWinTaskbarProgressPrivate
@@ -88,11 +75,11 @@ public:
int maximum;
bool visible;
bool paused;
- QWinTaskbarProgress::ProgressState state;
+ bool stopped;
};
QWinTaskbarProgressPrivate::QWinTaskbarProgressPrivate() :
- value(0), minimum(0), maximum(100), visible(false), paused(false), state(QWinTaskbarProgress::NormalState)
+ value(0), minimum(0), maximum(100), visible(false), paused(false), stopped(false)
{
}
@@ -112,28 +99,6 @@ QWinTaskbarProgress::~QWinTaskbarProgress()
}
/*!
- \property QWinTaskbarProgress::state
- \brief the state of the progress indicator
-
- The default value is \c NormalState.
- */
-QWinTaskbarProgress::ProgressState QWinTaskbarProgress::state() const
-{
- Q_D(const QWinTaskbarProgress);
- return d->state;
-}
-
-void QWinTaskbarProgress::setState(QWinTaskbarProgress::ProgressState state)
-{
- Q_D(QWinTaskbarProgress);
- if (state == d->state)
- return;
-
- d->state = state;
- emit stateChanged(d->state);
-}
-
-/*!
\property QWinTaskbarProgress::value
\brief the current value of the progress indicator
@@ -254,13 +219,11 @@ void QWinTaskbarProgress::setRange(int minimum, int maximum)
/*!
Resets the progress indicator.
- This function sets the state to \c NormalState and rewinds the
- value to the minimum value.
+ This function rewinds the value to the minimum value.
*/
void QWinTaskbarProgress::reset()
{
setValue(minimum());
- setState(NormalState);
}
/*!
@@ -278,7 +241,7 @@ bool QWinTaskbarProgress::isPaused() const
void QWinTaskbarProgress::setPaused(bool paused)
{
Q_D(QWinTaskbarProgress);
- if (paused == d->paused)
+ if (paused == d->paused || d->stopped)
return;
d->paused = paused;
@@ -294,11 +257,41 @@ void QWinTaskbarProgress::pause()
}
/*!
- Resume the progress indicator.
+ Resume a paused or stopped progress indicator.
*/
void QWinTaskbarProgress::resume()
{
+ Q_D(QWinTaskbarProgress);
+ setPaused(false);
+ if (d->stopped) {
+ d->stopped = false;
+ emit stoppedChanged(false);
+ }
+}
+
+/*!
+ \property QWinTaskbarProgress::stopped
+ \brief the progress indicator is stopped.
+
+ The default value is \c false.
+ */
+bool QWinTaskbarProgress::isStopped() const
+{
+ Q_D(const QWinTaskbarProgress);
+ return d->stopped;
+}
+
+/*!
+ Stop the progress indicator.
+ */
+void QWinTaskbarProgress::stop()
+{
+ Q_D(QWinTaskbarProgress);
setPaused(false);
+ if (!d->stopped) {
+ d->stopped = true;
+ emit stoppedChanged(true);
+ }
}
QT_END_NAMESPACE