src/hbwidgets/popups/hbsliderpopup.cpp
changeset 0 16d8024aca5e
child 1 f7ac710697a9
equal deleted inserted replaced
-1:000000000000 0:16d8024aca5e
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (developer.feedback@nokia.com)
       
     6 **
       
     7 ** This file is part of the HbWidgets module of the UI Extensions for Mobile.
       
     8 **
       
     9 ** GNU Lesser General Public License Usage
       
    10 ** This file may be used under the terms of the GNU Lesser General Public
       
    11 ** License version 2.1 as published by the Free Software Foundation and
       
    12 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
       
    13 ** Please review the following information to ensure the GNU Lesser General
       
    14 ** Public License version 2.1 requirements will be met:
       
    15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    16 **
       
    17 ** In addition, as a special exception, Nokia gives you certain additional
       
    18 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    20 **
       
    21 ** If you have questions regarding the use of this file, please contact
       
    22 ** Nokia at developer.feedback@nokia.com.
       
    23 **
       
    24 ****************************************************************************/
       
    25 
       
    26 #include <hbslider.h>
       
    27 #include "hbsliderpopup_p.h"
       
    28 #include <hbstyle.h>
       
    29 #include <QDebug>
       
    30 
       
    31 #include <QTimeLine>
       
    32 #include <QGraphicsLinearLayout>
       
    33 
       
    34 /*!   
       
    35     internal- HbSliderPopupContentWidget class 
       
    36     creates content widget for slider popup
       
    37 */
       
    38 class HbSliderPopupContentWidget : public HbWidget
       
    39 {
       
    40     Q_OBJECT
       
    41 public:
       
    42     HbSliderPopupPrivate *d;
       
    43     HbSlider *slider;
       
    44     
       
    45     HbSliderPopupContentWidget(HbSliderPopupPrivate *priv,
       
    46         QGraphicsItem* parent =0) : HbWidget(parent),d(priv),slider(0)
       
    47     {
       
    48         d->createSlider();
       
    49         slider = d->slider;
       
    50         slider->setParentItem(this);
       
    51         HbStyle::setItemName( slider,"slider" );
       
    52     }
       
    53     enum { Type = HbPrivate::ItemType_SliderPopupContentWidget };
       
    54     int type() const { return Type; }
       
    55 };
       
    56 
       
    57 /*!   
       
    58     internal- HbSliderPopupPrivate class ctor
       
    59 */
       
    60 HbSliderPopupPrivate::HbSliderPopupPrivate():slider(0)
       
    61 {
       
    62 }
       
    63 
       
    64 /*!   
       
    65     internal- HbSliderPopupPrivate class dtor
       
    66 */
       
    67 HbSliderPopupPrivate::~HbSliderPopupPrivate()
       
    68 {
       
    69 
       
    70 }
       
    71 
       
    72 /*!  
       
    73     This is virtual function for creating slider
       
    74     derived class can over ride it and return required type of slider
       
    75     ex HbVolumeSlider or HbZoomSlider
       
    76 */
       
    77 void HbSliderPopupPrivate::createSlider() 
       
    78 {
       
    79     slider= new HbSlider();
       
    80 }
       
    81 
       
    82 /*!   
       
    83     This slot will be called when ever value change happens
       
    84     This will reset time out interval of popup
       
    85 */
       
    86 void HbSliderPopupPrivate ::_q_valueChanged(int val)
       
    87 {
       
    88     Q_Q(HbSliderPopup);
       
    89     startTimeout();
       
    90     emit q->valueChanged(val);
       
    91 }
       
    92 
       
    93 /*!
       
    94    create slider and delegate all signals of slider
       
    95 */
       
    96 void HbSliderPopupPrivate::init()
       
    97 {
       
    98     Q_Q( HbSliderPopup);
       
    99     mSliderPopupContentWidget = new HbSliderPopupContentWidget( this );
       
   100     q->setContentWidget( mSliderPopupContentWidget );
       
   101     q->setBackgroundItem(HbStyle::P_SliderPopup_background);
       
   102     HbStyle::setItemName(q->backgroundItem(),QLatin1String("sliderpopup_background"));
       
   103 
       
   104     q->connect(mSliderPopupContentWidget->slider,SIGNAL(valueChanged(int)),q,SLOT(_q_valueChanged(int)));
       
   105     q->connect(mSliderPopupContentWidget->slider,SIGNAL(sliderPressed()),q,SIGNAL(sliderPressed()));
       
   106     q->connect(mSliderPopupContentWidget->slider,SIGNAL(sliderReleased()),q,SIGNAL(sliderReleased()));
       
   107     q->connect(mSliderPopupContentWidget->slider,SIGNAL(rangeChanged(int , int  )),
       
   108         q,SIGNAL(rangeChanged(int , int  )));
       
   109     q->connect(mSliderPopupContentWidget->slider,SIGNAL(sliderMoved(int)),q,SIGNAL(sliderMoved(int)));
       
   110     q->connect(mSliderPopupContentWidget->slider,SIGNAL(iconPressed()),q,SIGNAL(iconPressed()));
       
   111     q->connect(mSliderPopupContentWidget->slider,SIGNAL(iconReleased()),q,SIGNAL(iconReleased()));
       
   112     q->connect(mSliderPopupContentWidget->slider,SIGNAL(iconClicked()),q,SIGNAL(iconClicked()));
       
   113     q->connect(mSliderPopupContentWidget->slider,SIGNAL(textClicked()),q,SIGNAL(textClicked()));
       
   114 
       
   115     q->setDismissPolicy(HbDialog::TapOutside);
       
   116     q->setBackgroundFaded(false);
       
   117     q->setModal(false);
       
   118     mainLayout->setContentsMargins(0,0,0,0);
       
   119     mSliderPopupContentWidget->slider->setFlags(QGraphicsItem::ItemIsFocusable);
       
   120 }
       
   121 
       
   122 /*!
       
   123     @beta
       
   124     @hbwidgets
       
   125     \class HbSliderPopup
       
   126     \brief HbSliderPopup widget provides a generic vertical or horizontal 
       
   127     slider embeeded in a popup.
       
   128 
       
   129     HbSliderPopup is a classic widget for controlling a bounded value.
       
   130     It lets the user move a slider handle along a horizontal or vertical
       
   131     track and translates the handle's position into an integer value
       
   132     within the legal range.
       
   133 
       
   134     The most important functions are setValue() to set the slider directly
       
   135     to some value; and setMinimum() and setMaximum() to define the range
       
   136     of the slider.
       
   137 
       
   138     HbSliderPopup consists of elements. The available slider elements are
       
   139     defined by the Hb::SliderElement enumeration. A set of elements
       
   140     can be set by setSliderElements() and currently existing elements can be
       
   141     queried by sliderElements().
       
   142 
       
   143     HbSliderPopup provides methods for controlling tickmarks.  You can use
       
   144     setTickPosition() to indicate where you want the tickmarks to be,
       
   145     setMajorTickInterval() and setMinorTickInterval() to indicate how
       
   146     many of them you want. The current set tick position and intervals
       
   147     can be queried using the tickPosition(), majorTickInterval() and
       
   148     minorTickInterval() functions, respectively.
       
   149 
       
   150     HbSliderPopup provides a comprehensive set of signals:
       
   151     \li valueChanged() Emitted when the slider's value has changed. The tracking()
       
   152        determines whether this signal is emitted during user
       
   153        interaction.
       
   154     \li sliderPressed() Emitted when the user starts to drag the slider.
       
   155     \li sliderMoved() Emitted when the user drags the slider.
       
   156     \li sliderReleased() Emitted when the user releases the slider.
       
   157     \li rangeChanged() Emitted when the range of the slider changes.
       
   158     \li iconPressed() Emitted when the user presses the associated slider icon.
       
   159     \li iconReleased() Emitted when the user releases the associated slider icon.
       
   160     \li iconClicked() Emitted when the user clicks the associated slider icon.
       
   161 
       
   162     HbSliderPopup provides only integer ranges. Note that although
       
   163     HbSliderPopup handles very large numbers, it becomes difficult for users
       
   164     to use a slider accurately for very large ranges.
       
   165 
       
   166     The slider handles keys in the following way:
       
   167     \li Left/Right moves a horizontal slider by one single step.
       
   168     \li Up/Down moves a vertical slider by one single step.
       
   169 
       
   170     Example usage:
       
   171     \code
       
   172     HbSliderPopup *slider = new HbSliderPopup();
       
   173     connect(slider, SIGNAL(valueChanged(int)), receiver, SLOT(volumeSliderChanged(int)));
       
   174     connect(slider, SIGNAL(iconToggled(bool)), receiver, SLOT(volumeMuted(bool)));
       
   175     \endcode
       
   176 
       
   177     \sa HbZoomSliderPopup, HbVolumeSliderPopup
       
   178 */
       
   179 
       
   180 /*!
       
   181     \fn void HbSliderPopup::valueChanged(int value)
       
   182 
       
   183     This signal is emitted when the slider value has changed.
       
   184 
       
   185     \sa hasTracking()
       
   186 */
       
   187 
       
   188 /*!
       
   189     \fn void HbSliderPopup::sliderPressed()
       
   190 
       
   191     This signal is emitted when the slider thumb has been pressed.
       
   192 */
       
   193 
       
   194 /*!
       
   195     \fn void HbSliderPopup::sliderReleased()
       
   196 
       
   197     This signal is emitted when the slider thumb has been released.
       
   198 */
       
   199 
       
   200 /*!
       
   201     \fn void HbSliderPopup::sliderMoved(int value)
       
   202 
       
   203     This signal is emitted when the slider position has changed.
       
   204 
       
   205     \sa hasTracking()
       
   206 */
       
   207 
       
   208 /*!
       
   209     \fn void HbSliderPopup::rangeChanged(int min, int max)
       
   210 
       
   211     This signal is emitted when the slider range has changed.
       
   212 */
       
   213 
       
   214 /*!
       
   215     \fn void HbSliderPopup::iconPressed()
       
   216 
       
   217     This signal is emitted when the slider icon has been pressed.
       
   218 */
       
   219 
       
   220 /*!
       
   221     \fn void HbSliderPopup::iconReleased()
       
   222 
       
   223     This signal is emitted when the slider icon has been released.
       
   224 */
       
   225 
       
   226 /*!
       
   227     \fn void HbSliderPopup::iconClicked()
       
   228 
       
   229     This signal is emitted when the slider icon has been clicked.
       
   230 */
       
   231 
       
   232 
       
   233 /*!
       
   234     \reimp
       
   235     \fn int HbSliderPopup::type() const
       
   236  */
       
   237 
       
   238 /*!
       
   239     \enum HbSliderPopup::SliderElement
       
   240 
       
   241     This enum defines available slider elements.
       
   242  */
       
   243 
       
   244 /*!
       
   245     \var HbSliderPopup::IncreaseElement
       
   246 
       
   247     A button to increase the slider value. Usually a plus sign.
       
   248  */
       
   249 
       
   250 /*!
       
   251     \var HbSliderPopup::TrackElement
       
   252 
       
   253     The slider track that consists of a groove, ticks and handle.
       
   254  */
       
   255 
       
   256 /*!
       
   257     \var HbSliderPopup::DecreaseElement
       
   258 
       
   259     A button to decrease the slider value. Usually a minus sign.
       
   260  */
       
   261 
       
   262 /*!
       
   263     \var HbSliderPopup::IconElement
       
   264 
       
   265     An icon element associated to the slider.
       
   266  */
       
   267 
       
   268 /*!
       
   269     \var HbSliderPopup::TextElement
       
   270 
       
   271     A text element associated to the slider.
       
   272  */
       
   273 
       
   274 
       
   275 
       
   276 /*!
       
   277     Constructs a slider embeeded in a popup with \a parent.
       
   278 
       
   279     The orientation is \b Qt::Vertical and the slider contains only track element by default.
       
   280 
       
   281     \sa setOrientation(), setElements()
       
   282 */
       
   283 HbSliderPopup::HbSliderPopup(QGraphicsItem *parent) :
       
   284     HbDialog(*new HbSliderPopupPrivate, parent)
       
   285 {
       
   286     Q_UNUSED( parent);
       
   287     Q_D(HbSliderPopup);
       
   288     d->q_ptr = this;
       
   289     d->init();
       
   290 }
       
   291 
       
   292 /*!
       
   293 Constructs a sliderPopup with a \a orientation and \a parent.
       
   294 
       
   295 The slider contains only track element by default.
       
   296 
       
   297 \sa setElements()
       
   298 */
       
   299 HbSliderPopup::HbSliderPopup(Qt::Orientation orientation, QGraphicsItem *parent) :
       
   300     HbDialog(*new HbSliderPopupPrivate, parent)
       
   301 {
       
   302     Q_D(HbSliderPopup);
       
   303     d->q_ptr = this;
       
   304     d->init();
       
   305     setOrientation(orientation);
       
   306 }
       
   307 
       
   308 /*!
       
   309     \internal
       
   310  */
       
   311 HbSliderPopup::HbSliderPopup(HbSliderPopupPrivate &dd, QGraphicsItem *parent) :
       
   312     HbDialog(dd, parent)
       
   313 {
       
   314     Q_UNUSED( parent);
       
   315     Q_D(HbSliderPopup);
       
   316     d->q_ptr = this;
       
   317     d->init();
       
   318 }
       
   319 
       
   320 /*!
       
   321     Destructs the slider.
       
   322 */
       
   323 HbSliderPopup::~HbSliderPopup()
       
   324 {
       
   325 }
       
   326 
       
   327 /*!
       
   328     Returns the slider text.
       
   329 
       
   330     returns empty text if text element does not exist
       
   331 
       
   332     \sa setText()
       
   333 */
       
   334 QString HbSliderPopup::text() const
       
   335 {
       
   336     Q_D(const HbSliderPopup);
       
   337     return d->mSliderPopupContentWidget->slider->text();
       
   338 }
       
   339 
       
   340 /*!
       
   341     Sets the slider \a text for text element 
       
   342 
       
   343     Slider will not take care of localization.
       
   344 
       
   345     \warning Setting text to a non-existing text element has no effect.
       
   346 
       
   347     \sa text()
       
   348 */
       
   349 void HbSliderPopup::setText(const QString &text)
       
   350 {
       
   351     Q_D(HbSliderPopup);
       
   352     d->mSliderPopupContentWidget->slider->setText(text);
       
   353 }
       
   354 
       
   355 /*!
       
   356     Sets whether the tooltip is visible .
       
   357 
       
   358     \sa isToolTipVisible()
       
   359 */
       
   360 void HbSliderPopup::setToolTipVisible(bool value)
       
   361 {
       
   362     Q_D(const HbSliderPopup);
       
   363     d->mSliderPopupContentWidget->slider->setToolTipVisible(value);
       
   364 }
       
   365 
       
   366 /*!
       
   367     Returns \c true if tooltip is visible.
       
   368 
       
   369     The default value is \c false.
       
   370 
       
   371     \sa setToolTipVisible()
       
   372 */
       
   373 bool HbSliderPopup::isToolTipVisible()
       
   374 {
       
   375     Q_D(const HbSliderPopup);
       
   376     return d->mSliderPopupContentWidget->slider->isToolTipVisible();
       
   377 }
       
   378 
       
   379 /*!
       
   380    sets the toolTip Alignment with respect to the thumb.
       
   381 
       
   382     \sa toolTipAlignment()
       
   383 */
       
   384 void HbSliderPopup::setToolTipAlignment(Qt::Alignment alignment)
       
   385 {
       
   386     Q_D( HbSliderPopup);
       
   387     d->mSliderPopupContentWidget->slider->setToolTipAlignment(alignment);
       
   388 }
       
   389 
       
   390 /*!
       
   391     returns the tooltip Alignment with respect to the thumb
       
   392 
       
   393     \sa setToolTipAlignment()
       
   394 */
       
   395 Qt::Alignment HbSliderPopup::toolTipAlignment() const
       
   396 {
       
   397     Q_D(const HbSliderPopup);
       
   398     return d->mSliderPopupContentWidget->slider->toolTipAlignment();
       
   399 }
       
   400 
       
   401 
       
   402 /*!
       
   403     Returns the major ticklabels of the slider popup.
       
   404   
       
   405     \sa setMajorTickLabels()
       
   406 */
       
   407 QStringList HbSliderPopup::majorTickLabels() const
       
   408 {
       
   409     Q_D(const HbSliderPopup);
       
   410     return d->mSliderPopupContentWidget->slider->majorTickLabels();
       
   411 }
       
   412 
       
   413 /*!
       
   414     Sets the major ticklabels of the slider popup.
       
   415 
       
   416     Detailed description:
       
   417 
       
   418     Strings from the stringlist will be taken sequentially for drawing
       
   419     LabelItem,there exists a one-to-one mapping between tickmarkitem &
       
   420     tickmarklabelitem.
       
   421 
       
   422     case 1: if strings provided > tickmarks, labels are drawn for the
       
   423     strings which maps the tickmarkitems.If there are extra strings 
       
   424     available in the list beyond 1-1 mapping, those strings will be left out.
       
   425 
       
   426     case 2: if strings provided < tickmarks, labels are drawn only for strings
       
   427     provided.Rest of the tickmarkitems will be drawn without labelItem.
       
   428 
       
   429     case 3: If some tickmarkitems to be drawn without labelItem in the middle,
       
   430     specify empty string ("") for that item  in the string list.
       
   431 
       
   432     case 4: if both major & minor tickinterval are same,then only majortickLabel
       
   433     strings are taken into account for drawing the labelItem
       
   434 
       
   435     \sa majorTickLabels()
       
   436 */
       
   437 void HbSliderPopup::setMajorTickLabels(const QStringList &majorTickLabels)
       
   438 {
       
   439     Q_D(HbSliderPopup);
       
   440     return d->mSliderPopupContentWidget->slider->setMajorTickLabels(majorTickLabels);
       
   441 }
       
   442 
       
   443 /*!
       
   444     Returns the minor ticklabels of the slider popup.
       
   445   
       
   446     \sa setMajorTickLabels()
       
   447 */
       
   448 QStringList HbSliderPopup::minorTickLabels() const
       
   449 {
       
   450     Q_D(const HbSliderPopup);
       
   451     return d->mSliderPopupContentWidget->slider->minorTickLabels();
       
   452 }
       
   453 
       
   454 /*!
       
   455     Sets the minor ticklabels of the slider popup.
       
   456     see setMajorTickLabels for detailed description
       
   457 
       
   458     \sa minorTickLabels(),setMajorTickLabels()
       
   459 */
       
   460 void HbSliderPopup::setMinorTickLabels(const QStringList &minorTickLabels)
       
   461 {
       
   462     Q_D(HbSliderPopup);
       
   463     d->mSliderPopupContentWidget->slider->setMinorTickLabels(minorTickLabels);
       
   464 }
       
   465 
       
   466 /*!
       
   467     \deprecated
       
   468     Returns the icon of the \a element.
       
   469 
       
   470     returns NULL if element does not exist or icon was not set for this element
       
   471 
       
   472     \sa setIcon()
       
   473 */
       
   474 HbIcon HbSliderPopup::icon(HbSlider::SliderElement element) const
       
   475 {
       
   476     qDebug("HbSliderPopup::icon() is deprecated. Use elementIcons() instead.");
       
   477     Q_D(const HbSliderPopup);
       
   478     return(d->mSliderPopupContentWidget->slider->icon(element));
       
   479 }
       
   480 
       
   481 /*!
       
   482     \deprecated
       
   483     Sets the \a icon if the \a element.
       
   484 
       
   485     Supported elements:
       
   486     \li HbSlider::IncreaseElement
       
   487     \li HbSlider::DecreaseElement
       
   488     \li HbSlider::IconElement
       
   489 
       
   490     \warning Setting icon to a non-existing element has no effect.
       
   491 
       
   492     \sa icon() setElements()
       
   493 */
       
   494 void HbSliderPopup::setIcon(HbSlider::SliderElement element, const HbIcon &icon)
       
   495 {
       
   496     qDebug("HbSliderPopup::setIcon() is deprecated. Use setElementIcons() instead.");
       
   497     Q_D( HbSliderPopup);
       
   498     d->mSliderPopupContentWidget->slider->setIcon(element,icon);
       
   499 }
       
   500 
       
   501 /*!
       
   502     @beta
       
   503     Returns the icon of the \a element.
       
   504 
       
   505     returns NULL if element does not exist or icon was not set for this element
       
   506 
       
   507     \sa setElementIcon()
       
   508 */
       
   509 HbIcon HbSliderPopup::elementIcon(HbSlider::SliderElement element) const
       
   510 {
       
   511     Q_D(const HbSliderPopup);
       
   512     return(d->mSliderPopupContentWidget->slider->icon(element));
       
   513 }
       
   514 
       
   515 /*!
       
   516     @beta
       
   517     Sets the \a icon if the \a element.
       
   518 
       
   519     Supported elements:
       
   520     \li HbSlider::IncreaseElement
       
   521     \li HbSlider::DecreaseElement
       
   522     \li HbSlider::IconElement
       
   523 
       
   524     \warning Setting icon to a non-existing element has no effect.
       
   525 
       
   526     \sa elementIcon() setElements()
       
   527 */
       
   528 void HbSliderPopup::setElementIcon(HbSlider::SliderElement element, const HbIcon &icon)
       
   529 {
       
   530     Q_D( HbSliderPopup);
       
   531     d->mSliderPopupContentWidget->slider->setIcon(element,icon);
       
   532 }
       
   533 
       
   534 
       
   535 
       
   536 /*!
       
   537     @proto
       
   538     Returns the map , which consist of element name as key and icon name  as value
       
   539 
       
   540     returns NULL map if none of the element has icon
       
   541 
       
   542     \sa setElementIcons()
       
   543 */
       
   544 QMap<QString,QVariant> HbSliderPopup::elementIcons( )const
       
   545 {
       
   546     Q_D(const HbSliderPopup);
       
   547     return(d->mSliderPopupContentWidget->slider->elementIcons());
       
   548 }
       
   549 
       
   550 
       
   551 /*!
       
   552     @proto
       
   553     Sets the icons for elements
       
   554 
       
   555     key of \a elements is element name  QString)  and value is icon
       
   556     name to set on given element
       
   557     Use following string for specifying elements
       
   558     "IncreaseElement" for increase element
       
   559     "DecreaseElement" for decrease element
       
   560     "IconElement" for icon element
       
   561     
       
   562     Eg Usage:
       
   563     HbSlider slider;
       
   564     QMap<QString , QVariant> map;
       
   565     map.insert(  QString( "IncreaseElement", QVariant(":\icon\small.jpg"));
       
   566     map.insert(  QString( "IconElement", QVariant(":\icon\small.jpg"));
       
   567     slider.setElementIcons( map );
       
   568 
       
   569     \warning Setting icon to a non-existing element has no effect.
       
   570 
       
   571     \sa elementIcons() setSliderElements() setElementIcon()
       
   572 */
       
   573 
       
   574 void HbSliderPopup::setElementIcons(const QMap<QString,QVariant> &elements)
       
   575 {
       
   576     Q_D( HbSliderPopup);
       
   577     d->mSliderPopupContentWidget->slider->setElementIcons(elements);
       
   578 }
       
   579 
       
   580 
       
   581 /*!
       
   582     Returns \c true whether the slider track is inverted.
       
   583 
       
   584     The default value is \c false.
       
   585 
       
   586     If this property is \c false, the minimum and maximum will
       
   587     be shown in its classic position. If the value is \c true,
       
   588     the minimum and maximum appear at their opposite location.
       
   589 
       
   590     \sa setInvertedAppearance()
       
   591 */
       
   592 bool HbSliderPopup::invertedAppearance() const
       
   593 {
       
   594     Q_D(const HbSliderPopup);
       
   595     return d->mSliderPopupContentWidget->slider->invertedAppearance();
       
   596 }
       
   597 
       
   598 /*!
       
   599     Sets whether the slider track is \a inverted.
       
   600 
       
   601     \sa invertedAppearance()
       
   602 */
       
   603 void HbSliderPopup::setInvertedAppearance(bool inverted)
       
   604 {
       
   605     Q_D(HbSliderPopup);
       
   606     d->mSliderPopupContentWidget->slider->setInvertedAppearance(inverted);
       
   607  }
       
   608 
       
   609 /*!
       
   610     \deprecated
       
   611     Returns the elements of the slider.
       
   612 
       
   613     The slider contains only track element by default.
       
   614 
       
   615     \sa setElements()
       
   616 */
       
   617 QList<HbSlider::SliderElement> HbSliderPopup::elements() const
       
   618 {
       
   619     qDebug("HbSliderPopup::elements() is deprecated. Use sliderElements() instead.");
       
   620     Q_D(const HbSliderPopup);
       
   621     return (d->mSliderPopupContentWidget->slider->elements());
       
   622 }
       
   623 
       
   624 /*!
       
   625     \deprecated
       
   626     Sets the elements of the slider.
       
   627 
       
   628     \note Duplicate elements will be ignored.
       
   629 
       
   630     \note element order cant be changed
       
   631 
       
   632     \sa elements()
       
   633 */
       
   634 void HbSliderPopup::setElements(const QList<HbSlider::SliderElement> &elements)
       
   635 {
       
   636     qDebug("HbSliderPopup::setElements is deprecated. Use setSliderElements instead.");
       
   637     Q_D(HbSliderPopup);
       
   638     d->mSliderPopupContentWidget->slider->setElements(elements);
       
   639 
       
   640 }
       
   641 
       
   642 /*!
       
   643     Returns the list of slider elements as QVariant ( can be type-casted to HbSlider::SliderElement ).   
       
   644 
       
   645     The slider contains only track element by default.
       
   646 
       
   647     \sa setSliderElements()
       
   648 */
       
   649 QList<QVariant> HbSliderPopup::sliderElements() const
       
   650 {
       
   651     Q_D(const HbSliderPopup);
       
   652     return (d->mSliderPopupContentWidget->slider->sliderElements());
       
   653 }
       
   654 
       
   655 /*!
       
   656     Sets the elements of the slider.
       
   657 
       
   658     \note Duplicate elements will be ignored.
       
   659 
       
   660     \note element order cant be changed
       
   661 
       
   662     Eg Usages:
       
   663     HbSliderPopup slider;
       
   664     QList<QVariant> list;
       
   665     list.append( QVariant( HbSlider::IncreaseElement));
       
   666     list.append( QVariant( HbSlider::DecreaseElement));
       
   667     list.append( QVariant( HbSlider::IconElement));
       
   668     slider.setElements( list);
       
   669 
       
   670     The available slider elements are
       
   671     defined by the HbSlider::SliderElement enumeration
       
   672 
       
   673     \sa sliderElements()
       
   674 
       
   675 */
       
   676 void HbSliderPopup::setSliderElements(const QList<QVariant>&elements)
       
   677 {
       
   678     Q_D(HbSliderPopup);
       
   679     d->mSliderPopupContentWidget->slider->setSliderElements(elements);
       
   680 
       
   681 }
       
   682 
       
   683 
       
   684 /*!
       
   685     Returns the maximum value of the slider.
       
   686 
       
   687     The default value is \c 100.
       
   688 
       
   689     \sa setMaximum()
       
   690 */
       
   691 int HbSliderPopup::maximum() const
       
   692 {
       
   693     Q_D(const HbSliderPopup);
       
   694     return d->mSliderPopupContentWidget->slider->maximum();
       
   695 }
       
   696 
       
   697 /*!
       
   698     Sets the maximum value of the slider.
       
   699 
       
   700     \note When setting this property, the minimum is adjusted if
       
   701 
       
   702     necessary to ensure that the range remains valid.  Also the
       
   703 
       
   704     slider's current value is adjusted to be within the new range.
       
   705 
       
   706     \sa maximum()
       
   707 */
       
   708 void HbSliderPopup::setMaximum(int max)
       
   709 {
       
   710     Q_D(HbSliderPopup);
       
   711     d->mSliderPopupContentWidget->slider->setMaximum(max);
       
   712 }
       
   713 
       
   714 /*!
       
   715     Returns the minimum value of the slider.
       
   716 
       
   717     The default value is \c 0.
       
   718 
       
   719     \sa setMinimum()
       
   720 */
       
   721 int HbSliderPopup::minimum() const
       
   722 {
       
   723     Q_D(const HbSliderPopup);
       
   724     return d->mSliderPopupContentWidget->slider->minimum();
       
   725 }
       
   726 
       
   727 /*!
       
   728     Sets the minimum value of the slider.
       
   729 
       
   730     \note When setting this property, the maximum is adjusted if
       
   731     necessary to ensure that the range remains valid. Also the
       
   732     slider's current value is adjusted to be within the new range.
       
   733 
       
   734     \sa minimum()
       
   735 */
       
   736 void HbSliderPopup::setMinimum(int min)
       
   737 {
       
   738     Q_D(HbSliderPopup);
       
   739     d->mSliderPopupContentWidget->slider->setMinimum(min);
       
   740 }
       
   741 
       
   742 /*!
       
   743     This function is provided for convenience.
       
   744 
       
   745     Sets the slider's minimum to \a min and its maximum to \a max.
       
   746 
       
   747     If maximum is smaller than minimum, minimum becomes the only legal value.
       
   748 
       
   749     \sa setMinimum(), setMaximum()
       
   750 */
       
   751 void HbSliderPopup::setRange(int min, int max)
       
   752 {
       
   753     Q_D(HbSliderPopup);
       
   754     d->mSliderPopupContentWidget->slider->setRange(min, max);
       
   755 }
       
   756 
       
   757 /*!
       
   758     Returns the page step of the slider.
       
   759 
       
   760     The default value is \c 10.
       
   761 
       
   762     The larger of two natural steps that a slider provides
       
   763     and typically corresponds to the user pressing PageUp or PageDown.
       
   764 
       
   765     \sa setPageStep()
       
   766 */
       
   767 int HbSliderPopup::pageStep() const
       
   768 {
       
   769     Q_D(const HbSliderPopup);
       
   770     return d->mSliderPopupContentWidget->slider->pageStep();
       
   771 }
       
   772 
       
   773 /*!
       
   774     Sets the page \a step of the slider.
       
   775 
       
   776     \sa pageStep()
       
   777 */
       
   778 void HbSliderPopup::setPageStep(int step)
       
   779 {
       
   780     Q_D(HbSliderPopup);
       
   781     d->mSliderPopupContentWidget->slider->setPageStep(step);
       
   782 }
       
   783 
       
   784 /*!
       
   785     Returns the single step of the slider.
       
   786 
       
   787     The default value is \c 1.
       
   788 
       
   789     The smaller of two natural steps that an
       
   790     abstract sliders provides and typically corresponds to the user
       
   791     pressing an arrow key.
       
   792 
       
   793     \sa setSingleStep()
       
   794 */
       
   795 int HbSliderPopup::singleStep() const
       
   796 {
       
   797     Q_D(const HbSliderPopup);
       
   798     return d->mSliderPopupContentWidget->slider->singleStep();
       
   799 }
       
   800 
       
   801 /*!
       
   802     Sets the single \a step of the slider.
       
   803 
       
   804     \sa singleStep()
       
   805 */
       
   806 void HbSliderPopup::setSingleStep(int step)
       
   807 {
       
   808     Q_D(HbSliderPopup);
       
   809     d->mSliderPopupContentWidget->slider->setSingleStep(step);
       
   810 }
       
   811 
       
   812 /*!
       
   813     Returns the current slider position.
       
   814 
       
   815     If tracking is enabled (the default), this is identical to the value.
       
   816 
       
   817     \sa setSliderPosition()
       
   818 */
       
   819 int HbSliderPopup::sliderPosition() const
       
   820 {
       
   821     Q_D(const HbSliderPopup);
       
   822     return d->mSliderPopupContentWidget->slider->sliderPosition();
       
   823 }
       
   824 
       
   825 /*!
       
   826     Sets the current slider position.
       
   827 
       
   828     \sa sliderPosition()
       
   829 */
       
   830 void HbSliderPopup::setSliderPosition(int pos)
       
   831 {
       
   832     Q_D(HbSliderPopup);
       
   833     d->mSliderPopupContentWidget->slider->setSliderPosition(pos);
       
   834 }
       
   835 
       
   836 /*!
       
   837     Returns \c true whether slider tracking is enabled.
       
   838 
       
   839     The default value is \c true.
       
   840 
       
   841     If tracking is enabled, the slider emits the
       
   842     valueChanged() signal while the slider is being dragged. If
       
   843     tracking is disabled, the slider emits the valueChanged() signal
       
   844     only when the user releases the slider.
       
   845 
       
   846     \sa setTracking()
       
   847 */
       
   848 bool HbSliderPopup::hasTracking() const
       
   849 {
       
   850     Q_D(const HbSliderPopup);
       
   851     return d->mSliderPopupContentWidget->slider->hasTracking();
       
   852 }
       
   853 
       
   854 /*!
       
   855     Sets whether the slider tracking is enabled.
       
   856 
       
   857     \sa hasTracking()
       
   858 */
       
   859 void HbSliderPopup::setTracking(bool enable)
       
   860 {
       
   861     Q_D(HbSliderPopup);
       
   862     d->mSliderPopupContentWidget->slider->setTracking(enable);
       
   863 }
       
   864 
       
   865 /*!
       
   866     Returns the current value of the slider.
       
   867 
       
   868     The default value is \c 0.
       
   869 */
       
   870 int HbSliderPopup::value() const
       
   871 {
       
   872     Q_D(const HbSliderPopup);
       
   873     return d->mSliderPopupContentWidget->slider->value();
       
   874 }
       
   875 
       
   876 /*!
       
   877     Sets the current value of the slider.
       
   878 
       
   879     The slider forces the value to be within the legal range: \b
       
   880     minimum <= \c value <= \b maximum.
       
   881 
       
   882     Changing the value also changes the \b sliderPosition.
       
   883 
       
   884     \sa value()
       
   885 */
       
   886 void HbSliderPopup::setValue(int value)
       
   887 {
       
   888     Q_D(HbSliderPopup);
       
   889     d->mSliderPopupContentWidget->slider->setValue(value);
       
   890 }
       
   891 
       
   892 /*!
       
   893     Returns the tickmark position of the slider.
       
   894 
       
   895     The default value is \c HbSlider::NoTicks.
       
   896 
       
   897     \sa setTickPosition()
       
   898 */
       
   899 Hb::SliderTickPositions HbSliderPopup::tickPosition() const
       
   900 {
       
   901     Q_D(const HbSliderPopup);
       
   902     return d->mSliderPopupContentWidget->slider->tickPosition();
       
   903 }
       
   904 
       
   905 /*!
       
   906     Sets the tickmark position of the slider.
       
   907 
       
   908     \sa tickPosition()
       
   909  */
       
   910 void HbSliderPopup::setTickPosition(Hb::SliderTickPositions  position)
       
   911 {
       
   912     Q_D(HbSliderPopup);
       
   913     d->mSliderPopupContentWidget->slider->setTickPosition(position);
       
   914 }
       
   915 
       
   916 /*!
       
   917     Returns the SnappingMode of the slider.
       
   918 
       
   919     The default value is \c HbSlider::MinorTickSnapping.
       
   920 
       
   921     \sa setSnappingMode()
       
   922 */
       
   923 HbSlider::SnappingMode HbSliderPopup::snappingMode() const  
       
   924 {
       
   925     Q_D(const HbSliderPopup);
       
   926     HbSlider::SnappingMode mode = d->mSliderPopupContentWidget->slider->snappingMode();
       
   927     return mode;
       
   928 }
       
   929 
       
   930 /*!
       
   931     Sets the snappingMode of the slider.
       
   932 
       
   933     \sa snappingMode()
       
   934 */
       
   935 void HbSliderPopup::setSnappingMode(HbSlider::SnappingMode mode)   
       
   936 {
       
   937     Q_D(HbSliderPopup);
       
   938     d->mSliderPopupContentWidget->slider->setSnappingMode(mode);
       
   939 }
       
   940 
       
   941 /*!
       
   942     Sets the \a orientation of the sliderpopup.
       
   943 
       
   944     \sa orientation()
       
   945 */
       
   946 void HbSliderPopup::setOrientation(Qt::Orientation orientation)
       
   947 {
       
   948     Q_D(HbSliderPopup);
       
   949     d->mSliderPopupContentWidget->slider->setOrientation(orientation);
       
   950 }
       
   951 
       
   952 /*!
       
   953     Returns the orientation of the sliderpopup.
       
   954 
       
   955     The default value is \c Qt::Vertical.
       
   956 
       
   957     \sa setOrientation()
       
   958  */
       
   959 Qt::Orientation HbSliderPopup::orientation() const
       
   960 {
       
   961     Q_D(const HbSliderPopup);
       
   962     return d->mSliderPopupContentWidget->slider->orientation();
       
   963 }
       
   964 
       
   965 /*!
       
   966     Returns the interval between major tickmarks.
       
   967 
       
   968     The default value is \c 0.
       
   969 
       
   970     \sa setMajorTickInterval()
       
   971 */
       
   972 int HbSliderPopup::majorTickInterval() const
       
   973 {
       
   974     Q_D(const HbSliderPopup);
       
   975     return d->mSliderPopupContentWidget->slider->majorTickInterval();
       
   976 }
       
   977 
       
   978 /*!
       
   979     Sets the interval between major tickmarks.
       
   980 
       
   981     Special values:
       
   982     \li a negative value means no major ticks will be drawn
       
   983     \li value \c 0 means that the interval is automatically calculated
       
   984 
       
   985     \sa majorTickInterval()
       
   986 */
       
   987 void HbSliderPopup::setMajorTickInterval(int interval)
       
   988 {
       
   989     Q_D(HbSliderPopup);
       
   990     d->mSliderPopupContentWidget->slider->setMajorTickInterval(interval);
       
   991 }
       
   992 
       
   993 /*!
       
   994     Returns the interval between minor tickmarks.
       
   995 
       
   996     The default value is \c 0.
       
   997 
       
   998     \sa setMinorTickInterval()
       
   999 */
       
  1000 int HbSliderPopup::minorTickInterval() const
       
  1001 {
       
  1002     Q_D(const HbSliderPopup);
       
  1003     return d->mSliderPopupContentWidget->slider->minorTickInterval();
       
  1004 }
       
  1005 
       
  1006 /*!
       
  1007     Sets the interval between minor tickmarks.
       
  1008 
       
  1009     Special values:
       
  1010     \li a negative value means no minor ticks will be drawn
       
  1011     \li value \c 0 means that the interval is automatically calculated
       
  1012 
       
  1013     \sa minorTickInterval()
       
  1014 */
       
  1015 void HbSliderPopup::setMinorTickInterval(int interval)
       
  1016 {
       
  1017     Q_D(HbSliderPopup);
       
  1018     d->mSliderPopupContentWidget->slider->setMinorTickInterval(interval);
       
  1019 }
       
  1020 
       
  1021 /*!
       
  1022     \reimp
       
  1023  */
       
  1024 void HbSliderPopup::updatePrimitives()
       
  1025 {
       
  1026     Q_D(const HbSliderPopup);
       
  1027     d->mSliderPopupContentWidget->slider->updatePrimitives();
       
  1028     HbDialog::updatePrimitives();
       
  1029 }
       
  1030 
       
  1031 /*!
       
  1032     @proto
       
  1033     Sets whether to display progress track or not
       
  1034 
       
  1035     \default value is true
       
  1036 
       
  1037     \sa isTrackFilled( )
       
  1038 */
       
  1039 void HbSliderPopup::setTrackFilled(bool trackVisible )
       
  1040 {
       
  1041     
       
  1042     Q_D( const HbSliderPopup );
       
  1043     return d->mSliderPopupContentWidget->slider->setTrackFilled( trackVisible );
       
  1044 
       
  1045 }
       
  1046 
       
  1047 /*!
       
  1048     @proto
       
  1049     returns whether progress track is visible or not
       
  1050 
       
  1051     \sa setTrackFilled( )
       
  1052      
       
  1053 */
       
  1054 bool HbSliderPopup::isTrackFilled() const
       
  1055 {
       
  1056     Q_D( const HbSliderPopup );
       
  1057     return d->mSliderPopupContentWidget->slider->isTrackFilled();
       
  1058 
       
  1059 }
       
  1060 
       
  1061 
       
  1062 /*!
       
  1063     \reimp
       
  1064  */
       
  1065 QGraphicsItem * HbSliderPopup::primitive(HbStyle::Primitive primitive) const
       
  1066 {
       
  1067     Q_D(const HbSliderPopup);
       
  1068     return d->mSliderPopupContentWidget->slider->primitive( primitive );
       
  1069 }
       
  1070 
       
  1071 #include "moc_hbsliderpopup.cpp"
       
  1072 #include "hbsliderpopup.moc"