34
|
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 HbInput 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 |
#include "hbinputsettingpopup.h"
|
|
26 |
#include <hbview.h>
|
|
27 |
#include <hbinputpopupbase_p.h>
|
|
28 |
#include <hbinputregioncollector_p.h>
|
|
29 |
#include <hbpushbutton.h>
|
|
30 |
#include <QGraphicsLinearLayout>
|
|
31 |
#include <hbdataform.h>
|
|
32 |
#include <hbinputsettingwidget.h>
|
|
33 |
#include <hbmainwindow.h>
|
|
34 |
|
|
35 |
/*!
|
|
36 |
@stable
|
|
37 |
@hbinput
|
|
38 |
\class HbInputSettingPopup
|
|
39 |
\brief Popup for changing input settings in any application.
|
|
40 |
|
|
41 |
Displays the same content as control panel, but inside a popup.
|
|
42 |
|
|
43 |
\sa HbInputSettingWidget
|
|
44 |
*/
|
|
45 |
|
|
46 |
const QPoint HbSettingPopupLocation(3,3);
|
|
47 |
const QSize HbBackButtonSize(70, 45);
|
|
48 |
|
|
49 |
class HbInputSettingPopupPrivate: public HbInputPopupBasePrivate
|
|
50 |
{
|
|
51 |
Q_DECLARE_PUBLIC(HbInputSettingPopup)
|
|
52 |
|
|
53 |
public:
|
|
54 |
HbInputSettingPopupPrivate();
|
|
55 |
~HbInputSettingPopupPrivate();
|
|
56 |
|
|
57 |
public:
|
|
58 |
HbView* mSettingView;
|
|
59 |
};
|
|
60 |
|
|
61 |
HbInputSettingPopupPrivate::HbInputSettingPopupPrivate(): mSettingView(0)
|
|
62 |
{
|
|
63 |
}
|
|
64 |
|
|
65 |
HbInputSettingPopupPrivate::~HbInputSettingPopupPrivate()
|
|
66 |
{
|
|
67 |
}
|
|
68 |
|
|
69 |
HbInputSettingPopup::HbInputSettingPopup(QGraphicsWidget *parent)
|
|
70 |
: HbInputPopupBase(*new HbInputSettingPopupPrivate(), parent)
|
|
71 |
{
|
|
72 |
Q_D(HbInputSettingPopup);
|
|
73 |
|
|
74 |
connect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(orientationChanged()));
|
|
75 |
|
|
76 |
HbPushButton *button = new HbPushButton();
|
|
77 |
HbIcon backIcon = HbIcon("qtg_mono_back");
|
|
78 |
button->setIcon(backIcon);
|
|
79 |
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
80 |
button->setObjectName("SettingsPopupBackButton");
|
|
81 |
connect(button, SIGNAL(clicked()), this, SLOT(close()));
|
|
82 |
|
|
83 |
d->mSettingView = new HbView(this);
|
|
84 |
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
|
|
85 |
HbDataForm *dataForm = new HbDataForm();
|
|
86 |
HbInputSettingWidget *settingWidget = new HbInputSettingWidget(dataForm, d->mSettingView);
|
|
87 |
settingWidget->initializeWidget();
|
|
88 |
|
|
89 |
layout->addItem(button);
|
|
90 |
layout->setAlignment(button, Qt::AlignRight);
|
|
91 |
button->setMaximumSize(HbBackButtonSize);
|
|
92 |
layout->addItem(dataForm);
|
|
93 |
d->mSettingView->setLayout(layout);
|
|
94 |
HbInputRegionCollector::instance()->attach(d->mSettingView);
|
|
95 |
|
|
96 |
setContentWidget(d->mSettingView);
|
|
97 |
setModal(true);
|
|
98 |
setPreferredPos(HbSettingPopupLocation);
|
|
99 |
|
|
100 |
setDismissPolicy(HbPopup::NoDismiss);
|
|
101 |
setTimeout(HbPopup::NoTimeout);
|
|
102 |
}
|
|
103 |
|
|
104 |
HbInputSettingPopup::~HbInputSettingPopup()
|
|
105 |
{
|
|
106 |
Q_D(HbInputSettingPopup);
|
|
107 |
HbInputRegionCollector::instance()->detach(d->mSettingView);
|
|
108 |
}
|
|
109 |
|
|
110 |
void HbInputSettingPopup::close()
|
|
111 |
{
|
|
112 |
HbDialog::close();
|
|
113 |
emit dialogClosed();
|
|
114 |
}
|
|
115 |
|
|
116 |
void HbInputSettingPopup::orientationChanged()
|
|
117 |
{
|
|
118 |
repolish();
|
|
119 |
}
|
|
120 |
|
|
121 |
// End of file
|