18 |
18 |
19 #include <QGraphicsLinearLayout> |
19 #include <QGraphicsLinearLayout> |
20 #include <QModelIndex> |
20 #include <QModelIndex> |
21 |
21 |
22 #include <hbview.h> |
22 #include <hbview.h> |
23 #include <hblabel.h> |
|
24 #include <hblistview.h> |
23 #include <hblistview.h> |
25 #include <hblistviewitem.h> |
24 #include <hblistviewitem.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. However, it does not use HbDataForm as its widget and as its parent does, so |
38 framework. |
36 it uses SetWidget to set the listview to its widget instead of an HbDataForm. |
|
37 */ |
39 */ |
38 |
40 |
39 /*! |
41 /*! |
40 constructor. Creates the heading label and the list and adds it to layout. |
42 constructor. Creates the heading label and the list and adds it to layout. |
41 */ |
43 */ |
42 CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), |
44 CpThemeListView::CpThemeListView(QGraphicsItem *parent) : CpBaseSettingView(0, parent), |
43 mThemeList(new HbListView(this)) |
45 mThemeList(new HbListView(this)) |
44 { |
46 { |
45 |
47 |
46 //Create a layout with a heading "Select theme" at top and the list below it. |
48 //Create a layout with a heading 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); |
|
51 layout->setContentsMargins(0,0,0,0); |
49 |
52 |
50 //setup the heading. |
53 //setup the heading. |
51 HbLabel* label = new HbLabel(hbTrId("txt_cp_title_select_theme"), contentWidget);//txt_cp_title_select_theme |
54 HbGroupBox *simpleLabel = new HbGroupBox(); |
52 layout->addItem(label); |
55 simpleLabel->setHeading(hbTrId("txt_cp_title_select_theme")); |
53 |
56 |
54 connect(mThemeList, SIGNAL(activated(const QModelIndex&)), |
57 layout->addItem(simpleLabel); |
55 this, SIGNAL(newThemeSelected(const QModelIndex&))); |
58 |
|
59 connect(mThemeList, SIGNAL(activated(QModelIndex)), |
|
60 this, SIGNAL(newThemeSelected(QModelIndex))); |
56 |
61 |
|
62 //set list item icons to be large. |
57 HbListViewItem* listViewItem = mThemeList->listItemPrototype(); |
63 HbListViewItem* listViewItem = mThemeList->listItemPrototype(); |
58 listViewItem->setGraphicsSize(HbListViewItem::LargeIcon); |
64 listViewItem->setGraphicsSize(HbListViewItem::LargeIcon); |
59 |
65 //set singleSelection to enable showing an indicator (e.g check mark) next to active theme. |
|
66 mThemeList->setSelectionMode(HbAbstractItemView::SingleSelection); |
|
67 |
60 //add the list to layout. |
68 //add the list to layout. |
61 layout->addItem(mThemeList); |
69 layout->addItem(mThemeList); |
|
70 |
|
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); |
62 |
82 |
63 contentWidget->setLayout(layout); |
83 contentWidget->setLayout(layout); |
64 |
84 |
65 setWidget(contentWidget); |
85 setWidget(contentWidget); |
|
86 |
66 } |
87 } |
67 |
88 |
68 /*! |
89 /*! |
69 destructor. |
90 destructor. |
70 */ |
91 */ |