31
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0""
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include "cpsampleview.h"
|
|
18 |
#include <hbdataform.h>
|
|
19 |
#include <qstringlist>
|
32
|
20 |
#include <QDebug>
|
31
|
21 |
#include <hbdataformmodel.h>
|
|
22 |
#include <cpsettingformitemdata.h>
|
|
23 |
#include <hbmessagebox.h>
|
|
24 |
|
|
25 |
CpSampleView::CpSampleView(QGraphicsItem *parent) :
|
|
26 |
CpBaseSettingView(0,parent),
|
|
27 |
mGroupItem(0),
|
|
28 |
mSliderItem(0),
|
|
29 |
mCheckBoxItem(0)
|
|
30 |
|
|
31 |
{
|
|
32 |
HbDataForm *form = settingForm();
|
|
33 |
if (form) {
|
|
34 |
HbDataFormModel *model = new HbDataFormModel;
|
|
35 |
|
|
36 |
form->setHeading(tr("View from sample plugin"));
|
|
37 |
mGroupItem = new HbDataFormModelItem(HbDataFormModelItem::GroupItem, QString("Group"));
|
|
38 |
|
|
39 |
model->appendDataFormItem(mGroupItem);
|
|
40 |
|
|
41 |
mSliderItem = new CpSettingFormItemData(HbDataFormModelItem::SliderItem,
|
|
42 |
QString("Sample Slider"));
|
|
43 |
form->addConnection(mSliderItem,SIGNAL(valueChanged(int)),this,SLOT(sliderValueChanged(int)));
|
|
44 |
mGroupItem->appendChild(mSliderItem);
|
|
45 |
|
|
46 |
mCheckBoxItem = new CpSettingFormItemData(HbDataFormModelItem::CheckBoxItem,
|
|
47 |
QString("Sample Check Box"));
|
|
48 |
form->addConnection(mCheckBoxItem,SIGNAL(stateChanged (int)),this,SLOT(checkBoxStateChanged(int)));
|
|
49 |
mGroupItem->appendChild(mCheckBoxItem);
|
|
50 |
|
|
51 |
form->setModel(model);
|
|
52 |
}
|
|
53 |
|
|
54 |
|
|
55 |
}
|
|
56 |
CpSampleView::~CpSampleView()
|
|
57 |
{
|
|
58 |
}
|
|
59 |
|
|
60 |
void CpSampleView::sliderValueChanged(int value)
|
|
61 |
{
|
|
62 |
//TODO: store your changes
|
|
63 |
HbMessageBox::launchInformationMessageBox(QString("slider value changed to:%1").arg(value));
|
|
64 |
}
|
|
65 |
void CpSampleView::checkBoxStateChanged(int state)
|
|
66 |
{
|
|
67 |
//TODO: store your changes
|
|
68 |
QString str = (state ? "checked" : "un-checked");
|
|
69 |
HbMessageBox::launchInformationMessageBox(str);
|
|
70 |
}
|
|
71 |
|