20 #include <QModelIndex> |
20 #include <QModelIndex> |
21 |
21 |
22 #include <hbview.h> |
22 #include <hbview.h> |
23 #include <hblistview.h> |
23 #include <hblistview.h> |
24 #include <hblistviewitem.h> |
24 #include <hblistviewitem.h> |
25 #include <hbdataform.h> |
25 #include <hbtoolbar.h> |
|
26 #include <hbaction.h> |
|
27 #include <hbgroupbox.h> |
|
28 |
26 |
29 |
27 #include "cpthemelistview.h" |
30 #include "cpthemelistview.h" |
28 |
31 |
29 /*! |
32 /*! |
30 \class CpThemeListView |
33 \class CpThemeListView |
31 \brief CpThemeListView displays a heading (Select theme) and a list of themes with |
34 \brief CpThemeListView displays a heading (e.g Theme) and a list of themes with |
32 corresponding icons. |
35 corresponding icons. |
33 |
36 |
34 Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel |
37 Note: This class is a subclass of CpBaseSettingView for compatibility with Control Panel |
35 framework. |
38 framework. |
36 */ |
39 */ |
40 */ |
43 */ |
41 CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), |
44 CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), |
42 mThemeList(new HbListView(this)) |
45 mThemeList(new HbListView(this)) |
43 { |
46 { |
44 |
47 |
45 |
48 //Create a layout with a heading at top and the list below it. |
46 //Create a layout with a heading "Select theme" at top and the list below it. |
|
47 HbWidget* contentWidget = new HbWidget(this); |
49 HbWidget* contentWidget = new HbWidget(this); |
48 QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); |
50 QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical); |
49 layout->setContentsMargins(0,0,0,0); |
51 layout->setContentsMargins(0,0,0,0); |
50 |
52 |
51 //setup the heading. |
53 //setup the heading. |
52 //Using an empty dataform as heading because the heading should |
54 HbGroupBox *simpleLabel = new HbGroupBox(); |
53 //look like an HbDataForm headiing. |
55 simpleLabel->setHeading(hbTrId("txt_cp_title_select_theme")); |
54 HbDataForm *form = new HbDataForm(contentWidget); |
56 |
55 form->setHeading(hbTrId("txt_cp_title_select_theme")); |
57 layout->addItem(simpleLabel); |
56 |
|
57 layout->addItem(form); |
|
58 //Fixed vertical policy so that the heading doesn't expand. |
|
59 form->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed, QSizePolicy::DefaultType); |
|
60 |
58 |
61 connect(mThemeList, SIGNAL(activated(QModelIndex)), |
59 connect(mThemeList, SIGNAL(activated(QModelIndex)), |
62 this, SIGNAL(newThemeSelected(QModelIndex))); |
60 this, SIGNAL(newThemeSelected(QModelIndex))); |
63 |
61 |
64 //set list item icons to be large. |
62 //set list item icons to be large. |
65 HbListViewItem* listViewItem = mThemeList->listItemPrototype(); |
63 HbListViewItem* listViewItem = mThemeList->listItemPrototype(); |
66 listViewItem->setGraphicsSize(HbListViewItem::LargeIcon); |
64 listViewItem->setGraphicsSize(HbListViewItem::LargeIcon); |
67 |
65 //set singleSelection to enable showing an indicator (e.g check mark) next to active theme. |
|
66 mThemeList->setSelectionMode(HbAbstractItemView::SingleSelection); |
|
67 |
68 //add the list to layout. |
68 //add the list to layout. |
69 layout->addItem(mThemeList); |
69 layout->addItem(mThemeList); |
70 layout->addStretch(); |
|
71 |
70 |
72 |
71 //Create the toolbar for Ovi Store. |
|
72 HbToolBar* toolBar = new HbToolBar(this); |
|
73 |
|
74 HbAction* oviAction = new HbAction(HbIcon("qtg_large_ovistore"), hbTrId("txt_cp_list_get_more_tones")); |
|
75 QObject::connect( oviAction, SIGNAL(triggered()), |
|
76 this, SIGNAL(oviClicked())); |
|
77 |
|
78 //Add Action to the toolbar and show toolbar |
|
79 toolBar->addAction(oviAction); |
|
80 |
|
81 setToolBar(toolBar); |
|
82 |
73 contentWidget->setLayout(layout); |
83 contentWidget->setLayout(layout); |
74 |
84 |
75 setWidget(contentWidget); |
85 setWidget(contentWidget); |
|
86 |
76 } |
87 } |
77 |
88 |
78 /*! |
89 /*! |
79 destructor. |
90 destructor. |
80 */ |
91 */ |