75 QObject::connect( selectAction, SIGNAL(triggered()), |
76 QObject::connect( selectAction, SIGNAL(triggered()), |
76 this, SLOT(themeSelected())); |
77 this, SLOT(themeSelected())); |
77 |
78 |
78 QObject::connect( cancelAction, SIGNAL(triggered()), |
79 QObject::connect( cancelAction, SIGNAL(triggered()), |
79 this, SIGNAL(aboutToClose())); |
80 this, SIGNAL(aboutToClose())); |
80 |
81 |
81 HbIconItem* layoutItem; |
82 QObject::connect( mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), |
82 //layout->addItem(&HbIconItem(mTheme.icon, this )); |
83 this, SLOT(previewOrientationChanged(Qt::Orientation))); |
|
84 |
|
85 |
83 if(mainWindow()->orientation() == Qt::Horizontal) { |
86 if(mainWindow()->orientation() == Qt::Horizontal) { |
84 layoutItem = new HbIconItem(mTheme.landscapePreviewIcon, this); |
87 mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this); |
85 } |
88 } |
86 else { |
89 else { |
87 layoutItem = new HbIconItem(mTheme.portraitPreviewIcon, this); |
90 mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this); |
88 } |
91 } |
89 layout->addItem(layoutItem); |
92 layout->addItem(mPreviewIcon); |
90 layout->setAlignment(layout->itemAt(0), Qt::AlignTop); |
93 layout->setAlignment(layout->itemAt(0), Qt::AlignTop); |
91 |
94 |
92 setToolBar(mToolBar); |
95 setToolBar(mToolBar); |
93 setLayout(layout); |
96 setLayout(layout); |
94 |
97 |
95 //Setup the Back button action and set softkey. Back button |
98 //Setup the Back button action and set softkey. Back button |
96 //takes the user to the theme list view. |
99 //takes the user to the theme list view. |
97 mSoftKeyBackAction = new HbAction(Hb::BackAction, this); |
100 mSoftKeyBackAction = new HbAction(Hb::BackNaviAction, this); |
98 QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()), |
101 QObject::connect(mSoftKeyBackAction, SIGNAL(triggered()), |
99 this, SIGNAL(aboutToClose()) ); |
102 this, SIGNAL(aboutToClose()) ); |
100 |
103 |
101 this->setNavigationAction(mSoftKeyBackAction); |
104 this->setNavigationAction(mSoftKeyBackAction); |
102 } |
105 } |
138 void CpThemePreview::themeSelected() |
141 void CpThemePreview::themeSelected() |
139 { |
142 { |
140 emit applyTheme(mTheme.name); |
143 emit applyTheme(mTheme.name); |
141 } |
144 } |
142 |
145 |
|
146 /*! |
|
147 * Slot to handle landscape/portrait orientation change to use the |
|
148 * right graphics. |
|
149 */ |
|
150 void CpThemePreview::previewOrientationChanged(Qt::Orientation orientation) |
|
151 { |
|
152 |
|
153 QGraphicsLinearLayout* previewLayout = dynamic_cast<QGraphicsLinearLayout*>(layout()); |
|
154 |
|
155 if(mPreviewIcon == dynamic_cast<HbIconItem*>(previewLayout->itemAt(1)) ) { |
|
156 previewLayout->removeAt(1); |
|
157 delete mPreviewIcon; |
|
158 mPreviewIcon = 0; |
|
159 |
|
160 if(orientation == Qt::Horizontal) { |
|
161 mPreviewIcon = new HbIconItem(mTheme.landscapePreviewIcon, this); |
|
162 } |
|
163 else { |
|
164 mPreviewIcon = new HbIconItem(mTheme.portraitPreviewIcon, this); |
|
165 } |
|
166 |
|
167 previewLayout->addItem(mPreviewIcon); |
|
168 } |
|
169 |
|
170 } |
|
171 |