controlpanelui/examples/groupplugin/src/cpsamplegroup.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 06 Jul 2010 14:17:10 +0300
changeset 25 19394c261aa5
parent 10 0a74be98a8bc
permissions -rw-r--r--
Revision: 201025 Kit: 2010127
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0""
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
 *
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
 *
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
 * Contributors:
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
 *
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
 * Description:
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
 *
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
 */
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
#include "cpsamplegroup.h"
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#include <cpsettingformitemdata.h>
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <cpitemdatahelper.h>
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <hbmessagebox.h>
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
CpSampleGroup::CpSampleGroup(CpItemDataHelper &itemDataHelper) :
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
    CpSettingFormItemData(HbDataFormModelItem::GroupItem,QString("Sample Group")),
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
    mSliderItem(0), 
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
    mCheckBoxItem(0)
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
{
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
    mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem,
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
            QString("Sample Slider"));
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
    itemDataHelper.addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int)));
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
    this->appendChild(mSliderItem);
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
    
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
    mCheckBoxItem = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem,
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
            QString("Sample Check Box"));
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
    itemDataHelper.addConnection(mCheckBoxItem,SIGNAL(stateChanged (int)),this,SLOT(checkBoxStateChanged(int)));
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
    this->appendChild(mCheckBoxItem);
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
}
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
CpSampleGroup::~CpSampleGroup()
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
{
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
    //TODO: release resource when necessary
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
}
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
void CpSampleGroup::sliderValueChanged(int value)
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
{
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    //TODO: store your changes
25
19394c261aa5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
    45
   // HbMessageBox::message(QString("slider value changed to:%1").arg(value));
10
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
}
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
void CpSampleGroup::checkBoxStateChanged(int state)
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
{
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    //TODO: store your changes
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
    QString str = (state ? "checked" : "un-checked");
25
19394c261aa5 Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 10
diff changeset
    51
   // HbMessageBox::message(str);
10
0a74be98a8bc Revision: 201005
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
}