|
1 /* |
|
2 * Copyright (c) 2010 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: Test applicaiton for SW install indicator plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "testindiapp.h" |
|
19 #include <hbmainwindow.h> |
|
20 #include <hbview.h> |
|
21 #include <QGraphicsLinearLayout> |
|
22 #include <hbtextitem.h> |
|
23 #include <hbcheckbox.h> |
|
24 #include <hbpushbutton.h> |
|
25 #include <hbindicator.h> |
|
26 |
|
27 const QString KInstallIndicator = "com.nokia.sifui.indi/1.0"; |
|
28 |
|
29 TestInstallIndicator::TestInstallIndicator(int& argc, char* argv[]) : HbApplication(argc, argv), |
|
30 mMainWindow(0), mMainView(0), mIndicator(0) |
|
31 { |
|
32 mMainWindow = new HbMainWindow(); |
|
33 mMainView = new HbView(); |
|
34 mMainView->setTitle(tr("TestInstIndi")); |
|
35 |
|
36 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
|
37 |
|
38 HbTextItem *infoText = new HbTextItem; |
|
39 infoText->setText("Enable/disable SW install progress indicator in status indicator area and/or in universal indicator popup."); |
|
40 infoText->setTextWrapping(Hb::TextWordWrap); |
|
41 layout->addItem(infoText); |
|
42 |
|
43 HbCheckBox *enableCheckBox = new HbCheckBox; |
|
44 enableCheckBox->setText("Activate install indicator"); |
|
45 connect(enableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(activateStateChanged(int))); |
|
46 layout->addItem(enableCheckBox); |
|
47 |
|
48 HbPushButton *closeButton = new HbPushButton("Close"); |
|
49 connect(closeButton, SIGNAL(clicked()), qApp, SLOT(quit())); |
|
50 layout->addItem(closeButton); |
|
51 |
|
52 mMainView->setLayout(layout); |
|
53 mMainWindow->addView(mMainView); |
|
54 mMainWindow->show(); |
|
55 } |
|
56 |
|
57 TestInstallIndicator::~TestInstallIndicator() |
|
58 { |
|
59 delete mIndicator; |
|
60 delete mMainView; |
|
61 delete mMainWindow; |
|
62 } |
|
63 |
|
64 void TestInstallIndicator::activateStateChanged(int state) |
|
65 { |
|
66 if (!mIndicator) { |
|
67 mIndicator = new HbIndicator; |
|
68 } |
|
69 |
|
70 Qt::CheckState s = static_cast<Qt::CheckState>(state); |
|
71 if (s == Qt::Checked) { |
|
72 mIndicator->activate(KInstallIndicator); |
|
73 } else { |
|
74 mIndicator->deactivate(KInstallIndicator); |
|
75 } |
|
76 } |
|
77 |