camerauis/cameraxui/cxui/src/cxuizoomslider.cpp
author hgs
Fri, 17 Sep 2010 16:35:28 +0300
changeset 58 ddba9caa7f32
parent 39 c5025ea871a1
permissions -rw-r--r--
201037
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     1
/*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     3
* All rights reserved.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     8
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
     9
* Initial Contributors:
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    11
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    12
* Contributors:
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    13
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    14
* Description:
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    15
*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    16
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    17
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    18
#include <QGraphicsSceneMouseEvent>
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    19
#include "cxuizoomslider.h"
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    20
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    21
/*!
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    22
    \class CxuiZoomSlider
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    23
    \brief CxuiZoomSlider is a camera specific slider that is derived from HbSlider
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    24
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    25
    CxuiZoomslider has been created so that we are able to control and filter user
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    26
    mouse press events. All mouse press events that happen in slider rect are
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    27
    accepted in this class so that they won't be given any other components.
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    28
    This has to be done to prevent the slider to dismiss when accidentally 
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    29
    missing e.g.slider thumb touch area (camera view underneath will get the 
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    30
    event and hide the slider). 
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    31
    
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    32
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    33
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    34
CxuiZoomSlider::CxuiZoomSlider(QGraphicsItem *parentItem)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    35
: HbSlider(parentItem)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    36
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    37
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    38
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    39
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    40
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    41
CxuiZoomSlider::~CxuiZoomSlider()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    42
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    43
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    44
}
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    45
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    46
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    47
/*
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    48
* CxuiZoomSlider::mousePressEvent()
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    49
*/
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    50
void CxuiZoomSlider::mousePressEvent(QGraphicsSceneMouseEvent *event)
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    51
{
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    52
    HbSlider::mousePressEvent(event);
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    53
    
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    54
    // accept event so that it will not be given to the components
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    55
    // underneath this slider
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    56
    event->accept();
3075d9b614e6 201017_1
hgs
parents:
diff changeset
    57
}
39
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    58
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    59
/*!
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    60
* Adding zoom buttons to the slider
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    61
*/
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    62
void CxuiZoomSlider::addZoomButtons()
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    63
{
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    64
    // get current slider elements
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    65
    QList<QVariant> elements = sliderElements();
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    66
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    67
    // add increase and decrease elements to the slider
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    68
    elements << HbSlider::IncreaseElement << HbSlider::DecreaseElement;
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    69
    setSliderElements(elements);
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    70
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    71
    // set icons for the increase and decrease element
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    72
    setElementIcon(HbSlider::DecreaseElement , HbIcon("qtg_mono_minus"));
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    73
    setElementIcon(HbSlider::IncreaseElement , HbIcon("qtg_mono_plus"));
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    74
}
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    75
c5025ea871a1 201021_1
hgs
parents: 28
diff changeset
    76
//End of file