diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-05-06 09:48:45 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-05-06 09:48:45 (GMT) |
commit | a80b082e9307aa819259590fd98ae135450930f1 (patch) | |
tree | 852d2525d19f665163236d33c0787fe8e6625b79 /src/gui | |
parent | b246f8a8beab858468777f433f49faf62edcb07e (diff) | |
download | Qt-a80b082e9307aa819259590fd98ae135450930f1.zip Qt-a80b082e9307aa819259590fd98ae135450930f1.tar.gz Qt-a80b082e9307aa819259590fd98ae135450930f1.tar.bz2 |
S60Style: Add support for busy indicator for progres bar.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 32 | ||||
-rw-r--r-- | src/gui/styles/qs60style_p.h | 1 | ||||
-rw-r--r-- | src/gui/styles/qs60style_symbian.cpp | 1 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 87353f9..ae639d7 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1472,21 +1472,27 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_ProgressBarContents: if (const QStyleOptionProgressBarV2 *optionProgressBar = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) { QRect progressRect = optionProgressBar->rect; - const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 - : (qreal)optionProgressBar->progress / optionProgressBar->maximum; - if (optionProgressBar->orientation == Qt::Horizontal) { - progressRect.setWidth(int(progressRect.width() * progressFactor)); - if(optionProgressBar->direction == Qt::RightToLeft) - progressRect.translate(optionProgressBar->rect.width()-progressRect.width(),0); - progressRect.adjust(1, 0, -1, 0); + + if (optionProgressBar->minimum == optionProgressBar->maximum && optionProgressBar->minimum == 0) { + // busy indicator + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWait, painter, progressRect,flags); } else { - progressRect.adjust(0, 1, 0, -1); - progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor)); + const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 + : (qreal)optionProgressBar->progress / optionProgressBar->maximum; + if (optionProgressBar->orientation == Qt::Horizontal) { + progressRect.setWidth(int(progressRect.width() * progressFactor)); + if(optionProgressBar->direction == Qt::RightToLeft) + progressRect.translate(optionProgressBar->rect.width()-progressRect.width(),0); + progressRect.adjust(1, 0, -1, 0); + } else { + progressRect.adjust(0, 1, 0, -1); + progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor)); + } + + const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ? + QS60StylePrivate::SE_ProgressBarIndicatorHorizontal : QS60StylePrivate::SE_ProgressBarIndicatorVertical; + QS60StylePrivate::drawSkinElement(skinElement, painter, progressRect, flags); } - - const QS60StylePrivate::SkinElements skinElement = optionProgressBar->orientation == Qt::Horizontal ? - QS60StylePrivate::SE_ProgressBarIndicatorHorizontal : QS60StylePrivate::SE_ProgressBarIndicatorVertical; - QS60StylePrivate::drawSkinElement(skinElement, painter, progressRect, flags); } break; case CE_ProgressBarGroove: diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 5afe702..7bfa57e 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -74,6 +74,7 @@ public: }; enum SkinParts { + SP_QgnGrafBarWait, SP_QgnGrafBarFrameCenter, SP_QgnGrafBarFrameSideL, SP_QgnGrafBarFrameSideR, diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp index 154cf29..f90aa5b 100644 --- a/src/gui/styles/qs60style_symbian.cpp +++ b/src/gui/styles/qs60style_symbian.cpp @@ -89,6 +89,7 @@ private: }; const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { + /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_AllReleases, EMbmAvkonQgn_graf_bar_wait_1 ,-1,-1}, /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_AllReleases, EMbmAvkonQgn_graf_bar_frame_center ,-1,-1}, /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_AllReleases, EMbmAvkonQgn_graf_bar_frame_side_l ,-1,-1}, /* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_AllReleases, EMbmAvkonQgn_graf_bar_frame_side_r ,-1,-1}, |