|
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: Shows the view of the TV-OUT accessory. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "tvoutview.h" |
|
19 |
|
20 #include <hbdocumentloader.h> |
|
21 #include <hbapplication.h> |
|
22 #include <hblabel.h> |
|
23 #include <hbcombobox.h> |
|
24 #include <accpolaccessorymode.h> |
|
25 #include <accpolgenericiddefinitions.h> |
|
26 |
|
27 TvOutView::TvOutView(HbMainWindow *window,int accessoryType) |
|
28 { |
|
29 HbDocumentLoader loader; |
|
30 bool viewLoaded(false); |
|
31 loader.load(":/xml/tvout.docml", &viewLoaded); |
|
32 Q_ASSERT_X(viewLoaded, "AccSettings", "Invalid docml file"); |
|
33 |
|
34 HbLabel *label; |
|
35 if( accessoryType == KPCWired || accessoryType == KPCUSB ) // wired |
|
36 { |
|
37 label = qobject_cast<HbLabel*>(loader.findWidget("image")); |
|
38 label->setIcon(HbIcon(":/images/wired_accessory.svg")); |
|
39 } |
|
40 else // wireless |
|
41 { |
|
42 label = qobject_cast<HbLabel*>(loader.findWidget("image")); |
|
43 label->setIcon(HbIcon(":/images/wireless_accessory.svg")); |
|
44 } |
|
45 |
|
46 label = qobject_cast<HbLabel*>(loader.findWidget("label")); |
|
47 label->setPlainText("Tv-Out"); |
|
48 label->setTextWrapping(Hb::TextWordWrap); |
|
49 |
|
50 label = qobject_cast<HbLabel*>(loader.findWidget("label_4")); |
|
51 label->setPlainText("TV Aspect Ratio"); |
|
52 label->setTextWrapping(Hb::TextWordWrap); |
|
53 |
|
54 HbComboBox *comboHandler = qobject_cast<HbComboBox*>(loader.findWidget("combobox")); |
|
55 |
|
56 // prepare the list of items to be there in combobox. |
|
57 QStringList comboItems; |
|
58 comboItems <<"4:3" <<"16:9"; |
|
59 comboHandler->addItems(comboItems); |
|
60 |
|
61 //set the current index of combobox to the current AspectRatio. |
|
62 iServerEngine = CGSServerEngine::NewL(); |
|
63 currentValue = iServerEngine->AspectRatioL(); |
|
64 comboHandler->setCurrentIndex(currentValue); |
|
65 |
|
66 //If the index changed in the combobox update the AspectRatio of the TV-Out Settings. |
|
67 QObject::connect(comboHandler , SIGNAL(currentIndexChanged(int)) , this , SLOT(currentIndexModified(int))); |
|
68 |
|
69 window->addView(loader.findWidget("view")); |
|
70 |
|
71 } |
|
72 |
|
73 TvOutView::~TvOutView() |
|
74 { |
|
75 if(iServerEngine) |
|
76 { |
|
77 delete iServerEngine; |
|
78 } |
|
79 } |
|
80 |
|
81 void TvOutView::currentIndexModified(int modifiedSlot) |
|
82 { |
|
83 iServerEngine->SetAspectRatioL( modifiedSlot ); |
|
84 } |