62
|
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 |
|
|
18 |
#include "welcomeview.h"
|
|
19 |
|
|
20 |
#include <hbview.h>
|
|
21 |
#include <hblabel.h>
|
|
22 |
#include <hbmenu.h>
|
|
23 |
#include <hbaction.h>
|
|
24 |
#include <hbpusHbutton.h>
|
|
25 |
|
|
26 |
#include <QSizePolicy>
|
|
27 |
#include <QSignalMapper>
|
|
28 |
#include <QGraphicsGridLayout>
|
|
29 |
|
|
30 |
#include <qtracker.h>
|
|
31 |
|
|
32 |
WelcomeView::WelcomeView(const QString &name)
|
|
33 |
:
|
|
34 |
HbView()
|
|
35 |
{
|
|
36 |
setObjectName(name);
|
|
37 |
setTitle(name);
|
|
38 |
mapper = new QSignalMapper(this);
|
|
39 |
mapper->setParent(this);
|
|
40 |
|
|
41 |
setTitle(title());
|
|
42 |
QSizePolicy policy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
43 |
|
|
44 |
QGraphicsGridLayout *layout = new QGraphicsGridLayout();
|
|
45 |
|
|
46 |
label = new HbLabel();
|
|
47 |
label->setSizePolicy(policy);
|
|
48 |
// label->setAlignment(Qt::AlignCenter);
|
|
49 |
layout->addItem(label, 7, 1, 3, 1);
|
|
50 |
|
|
51 |
connect(mapper, SIGNAL(mapped(int)), this, SLOT(setLabelText(int)));
|
|
52 |
|
|
53 |
bool result = false;
|
|
54 |
|
|
55 |
HbPushButton *buttonNextSib = new HbPushButton("Right", this);
|
|
56 |
buttonNextSib->setSizePolicy(policy);
|
|
57 |
layout->addItem(buttonNextSib, 1, 1, 1, 1);
|
|
58 |
// connectButton(buttonNextSib, HbViewCommandGoNextSibiling);
|
|
59 |
|
|
60 |
HbPushButton *buttonPreviousSib = new HbPushButton("Left", this);
|
|
61 |
buttonPreviousSib->setSizePolicy(policy);
|
|
62 |
layout->addItem(buttonPreviousSib, 2, 1, 1, 1);
|
|
63 |
// connectButton(buttonPreviousSib, HbViewCommandGoPreviousSibiling);
|
|
64 |
|
|
65 |
|
|
66 |
HbPushButton *buttonParent = new HbPushButton("Parent", this);
|
|
67 |
buttonParent->setSizePolicy(policy);
|
|
68 |
layout->addItem(buttonParent, 3, 1, 1, 1);
|
|
69 |
// connectButton(buttonParent, HbViewCommandGoParent);
|
|
70 |
|
|
71 |
HbPushButton *buttonChild = new HbPushButton("Child", this);
|
|
72 |
buttonChild->setSizePolicy(policy);
|
|
73 |
layout->addItem(buttonChild, 4, 1, 1, 1);
|
|
74 |
// connectButton(buttonChild, HbViewCommandGoDefaultChild);
|
|
75 |
|
|
76 |
HbPushButton *buttonForward = new HbPushButton("Forward", this);
|
|
77 |
buttonForward->setSizePolicy(policy);
|
|
78 |
layout->addItem(buttonForward, 5, 1, 1, 1);
|
|
79 |
// connectButton(buttonForward, HbViewCommandGoForward);
|
|
80 |
|
|
81 |
HbPushButton *buttonBack = new HbPushButton("Back", this);
|
|
82 |
buttonBack->setSizePolicy(policy);
|
|
83 |
layout->addItem(buttonBack, 6, 1, 1, 1);
|
|
84 |
// connectButton(buttonBack, HbViewCommandGoBack);
|
|
85 |
|
|
86 |
this->setLayout(layout);
|
|
87 |
}
|
|
88 |
|
|
89 |
WelcomeView::~WelcomeView()
|
|
90 |
{
|
|
91 |
}
|
|
92 |
|
|
93 |
bool WelcomeView::connectButton(HbPushButton *button, int commandId)
|
|
94 |
{
|
|
95 |
bool result = connect(button, SIGNAL(clicked()), mapper, SLOT(map()));
|
|
96 |
if (result) {
|
|
97 |
mapper->setMapping(button, commandId);
|
|
98 |
}
|
|
99 |
return result;
|
|
100 |
}
|
|
101 |
|
|
102 |
void WelcomeView::setLabelText(int commandId)
|
|
103 |
{
|
|
104 |
QString ltext("command id: %1");
|
|
105 |
label->setText(ltext.arg(commandId));
|
|
106 |
}
|